Recent

Author Topic: SQLITE3.DLL  (Read 3062 times)

TonyR500

  • New Member
  • *
  • Posts: 11
SQLITE3.DLL
« on: July 06, 2020, 02:36:49 pm »
Hi
Some years ago I wrote some Delphi applications for a company in the midlands and recently I was asked to do some enhancements to these Delphi programs.

Since modern versions of Delphi appear to be very expensive I decided to try to use Lazarus.
Although it seems very similar to Delphi I am a newcomer to Lazarus.

I have now downloaded the 64 bit version of Lazarus and am using this with Windows 7 (not yet updated to Windows 10). I am currently trying to rewrite the 'Contacts' application used in the Sales Office. This is a simple application currently using dBase DBF files.

I have decided to replace these with a SQLite3 database. When I try to activate the SQLQuery component on my form I get an error message.

"Cannot load SQLite client library sqlite3.dll. Check your installation".

Also on the form are a SQLite3Connection, a SQLTransaction and a datasource component all connected in the usual way. There is also a DBGrid and a DBNavigator 

I have sqlite3.dll in my project folder and the Lazarus installation is brand new. Should I reinstall Lazarus or do I have sqlite3.dll in the wrong place.

Very glad of any suggestions.

Many Thanks
AJR

Awkward

  • Full Member
  • ***
  • Posts: 134
Re: SQLITE3.DLL
« Reply #1 on: July 06, 2020, 03:28:02 pm »
check first what your program and SQLite3.dll have the same bitness. i mean, app and dll can be x86 or x64. check whatthey are the same.

PascalDragon

  • Hero Member
  • *****
  • Posts: 5446
  • Compiler Developer
Re: SQLITE3.DLL
« Reply #2 on: July 06, 2020, 04:18:43 pm »
I have decided to replace these with a SQLite3 database. When I try to activate the SQLQuery component on my form I get an error message.

"Cannot load SQLite client library sqlite3.dll. Check your installation".

Also on the form are a SQLite3Connection, a SQLTransaction and a datasource component all connected in the usual way. There is also a DBGrid and a DBNavigator 

I have sqlite3.dll in my project folder and the Lazarus installation is brand new. Should I reinstall Lazarus or do I have sqlite3.dll in the wrong place.

To use SQLite from within the IDE (not your application) you need to place the library next to the Lazarus executable. The same is true for other DB clients that require a client DLL if they don't provide a global installation.

jamie

  • Hero Member
  • *****
  • Posts: 6090
Re: SQLITE3.DLL
« Reply #3 on: July 06, 2020, 04:19:39 pm »
you may need to down load and install the DLL file..

https://www.sqlite.org/download.html


Scroll down and pick the precompiled binaries and select the target you need.

 you could first try putting this DLL into your project folder
The only true wisdom is knowing you know nothing

TonyR500

  • New Member
  • *
  • Posts: 11
Re: SQLITE3.DLL
« Reply #4 on: July 06, 2020, 11:43:15 pm »
Hi

Thanks v much for all help. I downloaded sqlite3.dll from sqlite.org making sure I have the correct version. I then put this into the Lazarus executable folder. Result success. I now found I could make the SQLQuery component active without getting an error message.

I have since found that I also need sqlite3.dll in the same folder as the project executable. Without it  there are error messages at runtime. Problem therefore appears to be solved.

Many thanks again to all for help.

AJR

PascalDragon

  • Hero Member
  • *****
  • Posts: 5446
  • Compiler Developer
Re: SQLITE3.DLL
« Reply #5 on: July 07, 2020, 09:37:23 am »
I have since found that I also need sqlite3.dll in the same folder as the project executable. Without it  there are error messages at runtime. Problem therefore appears to be solved.

Yes, it needs to be in both locations as both binaries (the lazarus.exe and your application) need to be able to load the library.

Zvoni

  • Hero Member
  • *****
  • Posts: 2319
Re: SQLITE3.DLL
« Reply #6 on: July 07, 2020, 10:31:40 am »
On a sidenote:
IIRC, for Windows, the "recommended" Lazarus-Version is 32-Bit, and then to cross-compile to x64
But might be wrong.
One System to rule them all, One Code to find them,
One IDE to bring them all, and to the Framework bind them,
in the Land of Redmond, where the Windows lie
---------------------------------------------------------------------
Code is like a joke: If you have to explain it, it's bad

Pascal

  • Hero Member
  • *****
  • Posts: 932
Re: SQLITE3.DLL
« Reply #7 on: July 07, 2020, 10:57:02 am »
I have since found that I also need sqlite3.dll in the same folder as the project executable. Without it  there are error messages at runtime. Problem therefore appears to be solved.

Yes, it needs to be in both locations as both binaries (the lazarus.exe and your application) need to be able to load the library.

On a 64 bit Windows you can also put both dlls in the systems default locations:

64 bit dll to: C:\Windows\system32
32 bit dll to: C:\Windows\SysWOW64

So both 32 and 64 bit apps will work without copying dlls to the executable directories.
laz trunk x64 - fpc trunk i386 (cross x64) - Windows 10 Pro x64 (21H2)

Awkward

  • Full Member
  • ***
  • Posts: 134
Re: SQLITE3.DLL
« Reply #8 on: July 07, 2020, 11:05:56 am »
On a 64 bit Windows you can also put both dlls in the systems default locations:

64 bit dll to: C:\Windows\system32
32 bit dll to: C:\Windows\SysWOW64

So both 32 and 64 bit apps will work without copying dlls to the executable directories.

But that slightly dangerous coz if you publishing your program, you have a chance to forget to distribute sqlite3.dll with it

PascalDragon

  • Hero Member
  • *****
  • Posts: 5446
  • Compiler Developer
Re: SQLITE3.DLL
« Reply #9 on: July 07, 2020, 01:02:49 pm »
On a 64 bit Windows you can also put both dlls in the systems default locations:

64 bit dll to: C:\Windows\system32
32 bit dll to: C:\Windows\SysWOW64

So both 32 and 64 bit apps will work without copying dlls to the executable directories.

Yes, global directories are possible, but this has the danger - aside from what Awkward mentioned - that the global library might have an incompatible version. And Windows DLL usually are not versioned unlike *nix ones.

Pascal

  • Hero Member
  • *****
  • Posts: 932
Re: SQLITE3.DLL
« Reply #10 on: July 07, 2020, 01:33:37 pm »
Yes, global directories are possible, but this has the danger - aside from what Awkward mentioned - that the global library might have an incompatible version. And Windows DLL usually are not versioned unlike *nix ones.

Okay, convinced  :)
laz trunk x64 - fpc trunk i386 (cross x64) - Windows 10 Pro x64 (21H2)

 

TinyPortal © 2005-2018