[solved] Error sqlite3.dll use by Zeos

Forum related to SQLite

Moderators: gto, cipto_kh, EgonHugeist

Post Reply
Sapiem
Fresh Boarder
Fresh Boarder
Posts: 13
Joined: 14.11.2011, 20:21

[solved] Error sqlite3.dll use by Zeos

Post by Sapiem »

Greetings:

Having a sqlite3.dll in system folders (windows, system32, etc.) has priority than our own distributed application that normally put in the folder for our app. I've noticed this since I have in my app folder is the last of the original distro site sqlite.com yet when I call the function to see the version (using Delphi) informs me that version is lower, and this corresponds to the dll distributed by other applications such as Opera, Adobe, etc already installed previously.

How I can force Zeos to use the dll that is in the folder of my app and not the dll that exist in default system folders?

Thanks
User avatar
EgonHugeist
Zeos Project Manager
Zeos Project Manager
Posts: 1936
Joined: 31.03.2011, 22:38

Post by EgonHugeist »

Sapiem,

Now i don't know which revision do you use.. IF you checkout http://svn.code.sf.net/p/zeoslib/code-0 ... es/testing with TortoiseSVN then you can use TZConnection.LibraryLocation := 'C:\yourDir\sqlite3.dll'. This drops the default locations and you can use the dll you want to use..

Michael
Best regards, Michael

You want to help? http://zeoslib.sourceforge.net/viewtopic.php?f=4&t=3671
You found a (possible) bug? Use the new bugtracker dude! http://sourceforge.net/p/zeoslib/tickets/

Image
IndianaJones
Fresh Boarder
Fresh Boarder
Posts: 15
Joined: 20.10.2009, 16:11

Post by IndianaJones »

@Egon, are you sure that link is working cos I have tested that package but I got the following error.

In File 'C:\lazarus-libs\zeos\src\plain\ZPlainLoader.pas' at line 221:
raise Exception.Create(Format(SLibraryNotFound, [TriedLocations]));

Tested with the FPC 2.6.1
Lazarus 1.1 - SVN 39433
Windows 7 - 64Bit
Sqlite3 32 Bit DLL
User avatar
EgonHugeist
Zeos Project Manager
Zeos Project Manager
Posts: 1936
Joined: 31.03.2011, 22:38

Post by EgonHugeist »

IndianaJones,

i'm sure. The Exception you get happens if the library isn't compatible (32Bit vs. 64Bit) or can't be found.

Copy the 32Bit Library to Windows\SYSWOW64 or copy the 64Bit dll to Windows\system32. I know this is confusing but Microsoft makes the rules. On the other hand it IS possible to load the sqlite3.dll with TZConnection.LibraryLocation := '....'; I know with Postgre it won't work, because PostgreSQL uses some more DLL's.

Please check the dll you're trying to load is compatible and the patch+name is right.
Best regards, Michael

You want to help? http://zeoslib.sourceforge.net/viewtopic.php?f=4&t=3671
You found a (possible) bug? Use the new bugtracker dude! http://sourceforge.net/p/zeoslib/tickets/

Image
IndianaJones
Fresh Boarder
Fresh Boarder
Posts: 15
Joined: 20.10.2009, 16:11

Post by IndianaJones »

I copied the 32 bit DLL to the C:\Windows\SysWOW64 directory but the same error occurs again. Also I tried the following code without success. While debugging the error occurs at the ZConnection1.Connect; line.

procedure TForm1.FormActivate(Sender: TObject);
begin
libpath:=GetcurrentDir+PathDelim+'sqlite3.dll';
dbPath:=GetCurrentDir+PathDelim+'example.db';
ZConnection1.LibraryLocation:=libpath;
ZConnection1.Protocol:='sqlite-3';
ZConnection1.HostName:='localhost';
ZConnection1.Database:=dbPath;
ZConnection1.Connect;
if ZConnection1.Connected then
ShowMessage('Connected...')
else
ShowMessage('Not Connected...');
end;
User avatar
EgonHugeist
Zeos Project Manager
Zeos Project Manager
Posts: 1936
Joined: 31.03.2011, 22:38

Post by EgonHugeist »

IndianaJones,

what's your compiling target? 64Bit or 32Bit?
Best regards, Michael

You want to help? http://zeoslib.sourceforge.net/viewtopic.php?f=4&t=3671
You found a (possible) bug? Use the new bugtracker dude! http://sourceforge.net/p/zeoslib/tickets/

Image
IndianaJones
Fresh Boarder
Fresh Boarder
Posts: 15
Joined: 20.10.2009, 16:11

Post by IndianaJones »

@Egon,
I resolved the case, my old fpc is 2.6.1 64Bit, so in this case the error occurs. So I changed the fpc with 32Bit. Now the same source works just fine.
what should be the problem? Can I or you report that issue?
Thanks for your help.
User avatar
EgonHugeist
Zeos Project Manager
Zeos Project Manager
Posts: 1936
Joined: 31.03.2011, 22:38

Post by EgonHugeist »

IndianaJones,

you can't load a 32Bit dll with an 64Bit application and vice versa, by an generic way. This is where you've to take care about compatibility. On the Lazarus forum they call it 'dll-hell'. A nice expression for a thread which pops up again and again and the answers are allways the same..
Best regards, Michael

You want to help? http://zeoslib.sourceforge.net/viewtopic.php?f=4&t=3671
You found a (possible) bug? Use the new bugtracker dude! http://sourceforge.net/p/zeoslib/tickets/

Image
IndianaJones
Fresh Boarder
Fresh Boarder
Posts: 15
Joined: 20.10.2009, 16:11

Post by IndianaJones »

Thanks for the clarification.
Post Reply