can not load client library sqlite3.dll

Discussion of open issues, suggestions and bugs regarding LiteDAC (SQLite Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
vebaglaci
Posts: 6
Joined: Thu 05 Nov 2015 18:16

can not load client library sqlite3.dll

Post by vebaglaci » Tue 26 Sep 2017 06:37

Hello,

I'm using Delphi XE7, UNIDAC 6.1.3,Windows 7 X64,compiling project for X86 platform.

I'm trying to create sqlite database on runtime found below code in forum;

Code: Select all

var
  UniConnection: TUniConnection;
begin
  UniConnection := TUniConnection.Create(nil);
  UniConnection.ProviderName := 'SQLite';
  UniConnection.Database := 'C:\NewTetsDB.db3';
  UniConnection.SpecificOptions.Values['ForceCreateDatabase'] := 'True'; // In UniDAC 4.5.9 and higher
  UniConnection.Connect;
  UniConnection.ExecSQL('PRAGMA auto_vacuum = 1');
when i run it system returns "Can not load client library sqlite3.dll", searched through forum and google and find some solutions but none of it worked.

-Copied sqlite3.dll to the same folder with exe - not solved
-Tried to set sqlite3.dll path via component settings as "C:\myapp\bin\sqlite3.dll" - not solved

Another strange thing is when i try to connect any sqlite database it returns the same error, but if i follow this;
-Double click to uniconnection
-Options->Direct->True
then it's connecting to database without any problem.

In this case i need to create database and tables on runtime that's why i can not add uniconnection to my form, any ideas ?

MaximG
Devart Team
Posts: 1822
Joined: Mon 06 Jul 2015 11:34

Re: can not load client library sqlite3.dll

Post by MaximG » Tue 26 Sep 2017 09:41

UniDAC can work with SQLite database in two ways:

- using functions of the linked SQLite client library (for Windows OS it is sqlite3.dll). For this, the path to the library should be specified in the ClientLibrary property of the TUniConnection component
In this case, you should set the SpecificOptions property of the TUniConnection component in the following way:

Code: Select all

UniConnection.SpecificOptions.Values['ClientLibrary'] := '<path to sqlite3.dll>';
- without using the client library - so called Direct Mode - https://www.devart.com/unidac/docs/?sql ... rticle.htm .

vebaglaci
Posts: 6
Joined: Thu 05 Nov 2015 18:16

Re: can not load client library sqlite3.dll

Post by vebaglaci » Tue 26 Sep 2017 10:26

@MaximG thanks for your response.

I've added below code to my project but it didn't solve the issue

Code: Select all

UniConnection.SpecificOptions.Values['ClientLibrary'] := 'C:\Users\fsc\Desktop\SqLITE_DB_OLUSTURMA\Win32\Debug\sqlite3.dll';
according to online documentation added below code to switch direct mode and it solved;

Code: Select all

UniConnection.SpecificOptions.Values['Direct'] := 'True';
As far as i understand there are no performance differency between using sqlite3.dll and direct mode, am i right ?

MaximG
Devart Team
Posts: 1822
Joined: Mon 06 Jul 2015 11:34

Re: can not load client library sqlite3.dll

Post by MaximG » Tue 26 Sep 2017 12:14

Note that your application bitness and the client library must match. In case of using Win32 platform, you should use 32-bit library. Try using the library available on the project site : http://www.sqlite.org/download.html
Direct Mode is implemented using SQLite client library embedding to the application and does not require any external libraries to be linked to the project. Therefore, there is no speed difference when using both modes while working with SQLite DB.

Post Reply