Reputation: 343
I am getting sqlite3.dll
not found error at Delphi app. I already have sqlite3.dll file on my PC located at E://sqlite-dll-win32-x86-3071700
My source is as follows
procedure TForm2.Button1Click(Sender: TObject);
var
Results: TDataSet;
begin
SQLConnection1.Params.Add('Database=E://empn.s3db');
SQLConnection1.LibraryName := 'E://sqlite-dll-win32-x86-3071700/sqlite3.dll';
try
SQLConnection1.Connected := true;
SQLMonitor1.Active := True;
SQLConnection1.Execute('Selct * from usergroup', nil, Results)
finally
end;
end;
As mentioned in above code already pointed out path to the library by
SQLConnection1.LibraryName := 'E://sqlite-dll-win32-x86-3071700/sqlite3.dll';
But still I do get error like sqlite3.dll not found. how to troubleshoot this error?
Upvotes: 2
Views: 10435
Reputation: 11
I had the same issue with Delphi XE7. Turns out I had downloaded the 64-bit DLL but the application is 32-bit. I copied the 32-bit DLL to the application folder and I was then able to connect. Someone (JRL) stated this above...
Warning: Also make sure that you are not mixing 32 and 64 bits modules (i.e. 32 bit exe and 64 bit dll or vice versa).
Upvotes: 1
Reputation: 21
The same error occurs in Delphi XE7, download from https://www.sqlite.org/download.html, the binaries for windows and copy de sqlite3.def also in the system file you are using (system32 or SysWOW64). It seems it is missing in the installation of Delphi XE7.
Upvotes: 2
Reputation: 343
@TLama, @David Heffernan, JRL and many others, it worked out finally with Dotconnect for SQLite. I have not tried yet DBExpress Driver For SQLite as suggested by TLama. I think DBExpress Driver would also have resolved issue as both dotconnect and DBExpress driver have similar utility.
Upvotes: 1
Reputation: 612894
According to this Embarcadero blog article, the steps you need to take are:
TSQLConnection
instance and set the Driver
property to Sqlite
.It looks to me as though you have not performed step 3.
Regarding step 2, the preferred way to achieve that is to put the DLL in the same directory as your executable.
Upvotes: 1
Reputation: 3401
Beginning with Delphi XE3, LibraryName
is obsolete.
In older Delphi versions, LibraryName indicated the "dbExpress library associated with the driver" (e.g. dbxfb.dll for Firebird), while VendorLib indicated the "library supplied by the database vendor to support client-side use of the database" (e.g. fbclient.dll/fbembed.dll for Firebird, equivalent to Sqlite's sqlite3.dll).
In you are on Windows, this driver uses delayed loading of sqlite3.dll. Something like:
function sqlite3_open_v2; external 'sqlite3.dll' delayed;
so the dll is loaded with LoadLibrary and the standard search strategy to find modules applies (first the process directory, then the usual path list).
However this stategy can be altered by using SetDllDirectory.
So you have to put sqlite3.dll accessible thru your path or try the following hack:
(beware that this will interfere with other code that have used SetDllDirectory; see David Heffernan's comment)
SetDllDirectory('E:\sqlite-dll-win32-x86-3071700');
try
SQLConnection1.Open;
finally
SetDllDirectory(''); // restore default search order
end;
Warning: Also make sure that you are not mixing 32 and 64 bits modules (i.e. 32 bit exe and 64 bit dll or vice versa).
Upvotes: 5