Not Working On Mac - Cannot Load Client Library sqlite3.dll

Discussion of open issues, suggestions and bugs regarding usage of dbExpress drivers for SQLite in Delphi and C++Builder
Post Reply
DespatchSystems
Posts: 14
Joined: Tue 24 Jul 2012 10:45

Not Working On Mac - Cannot Load Client Library sqlite3.dll

Post by DespatchSystems » Fri 18 Jan 2013 13:44

Hi,

All working on PC, as soon as I connect TSQLConnection on Mac I get error "Project dylib raised exception class Exception with message 'Cannot load client library: sqlite3.dll'"

I have all the recommended dylib files from instructions on my deployment setup.

I have latest libsqlite3.dylib from xcode SDK.

Does it work for you with latest release?

Please help.

Greg

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: Not Working On Mac - Cannot Load Client Library sqlite3.dll

Post by AlexP » Fri 18 Jan 2013 14:23

Hello,

Please specify the IDE you are using: XE2 or XE3?

DespatchSystems
Posts: 14
Joined: Tue 24 Jul 2012 10:45

Re: Not Working On Mac - Cannot Load Client Library sqlite3.dll

Post by DespatchSystems » Fri 18 Jan 2013 15:01

Delphi XE3 Professional, checked the deployment in the PA scratch directory on OSX and it has the recommended files deployed:

libcgunwind.1.0.dylib
libdbexpsqlite40.dylib
libmidas.dylib
libsqlite.dylib

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: Not Working On Mac - Cannot Load Client Library sqlite3.dll

Post by AlexP » Mon 21 Jan 2013 13:48

Hello,

Try to specify the names of the used libraries explicitly in the following way:

Code: Select all

var
  SQLConnection: TSQLConnection;
begin
  SQLConnection := TSQLConnection.Create(nil);
  try
    SQLConnection.ConnectionName := 'Devart SQLite';
    SQLConnection.DriverName := 'DevartSQLite';
    SQLConnection.Params.Values['LibraryName'] := 'libdbexpsqlite40.dylib';
    SQLConnection.Params.Values['VendorLib'] := 'libsqlite3.dylib';
    SQLConnection.Params.Values['DataBase'] := 'test.db3';
    try
      SQLConnection.Connected := True;
    except
      on E:Exception do
        ShowMessage(e.Message);
    end;
  finally
    SQLConnection.Free;
  end;
end;

DespatchSystems
Posts: 14
Joined: Tue 24 Jul 2012 10:45

Re: Not Working On Mac - Cannot Load Client Library sqlite3.dll

Post by DespatchSystems » Mon 21 Jan 2013 17:03

Hi Alex,

It is working now, thanks.

I have a TSQLConection in a datamodule, the libraryname and vendorlib default to the windows settings at designtime. Setting libraryname and vendorlib programmatically using a compiler conditional define before connection did the trick.

{$IFDEF MSWINDOWS}
SAUserData.Params.Values['LibraryName'] := 'dbexpsqlite40.dll';
SAUserData.Params.Values['VendorLib'] := 'sqlite3.dll';
{$ENDIF}
{$IFDEF MACOS}
SAUserData.Params.Values['LibraryName'] := 'libdbexpsqlite40.dylib';
SAUserData.Params.Values['VendorLib'] := 'libsqlite3.dylib';
{$ENDIF}

Perhaps for a future version of your driver, you could detect when running on a Mac with windows LibraryName & vendorlib and autocorrect to the Mac settings at runtime? You may gets lots of support cases with other developers making the same mistake as I have.

Thanks for your help,

Greg

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: Not Working On Mac - Cannot Load Client Library sqlite3.dll

Post by AlexP » Tue 22 Jan 2013 10:14

Hello,

This behaviour (incorrect setting of these properties depending on a platform) is due to changes in Delphi XE3. We are investigating this problem at the moment and will probably fix the behaviour of our products, if it is possible.

Post Reply