Jump to content
new_x

SQLite Delphi 11 Community Edition

Recommended Posts

I have been trying to build a DB program by using sqlite. I downloaded
‘sqlite-dll-win64-x64-3430200.zip’ from sqlite home page, this is the current sqlite db implementation for windows 64 bit. This zip file just contains a dll and def file. I also downloaded the 32 bit tools file of the sqlite db (sqlite-tools-win32-x86-3430200.zip) . from this zip file I use “sqlite3.exe” (which is 32 bit I think). I copied the sqlite dll file into my Delphi app folder.

Then to create a db file, I used following command in command prompt;
sqlite3.exe sample.db

then I found the following VCL code obtained from embarcaderro site;
In the design time the SQLConnection1’s driver property is set to ‘sqlite’

procedure TForm1.Button1Click(Sender: TObject);
begin
SQLConnection1.Params.Add(‘Database=sample.db’);
try
// Establish the connection.
SQLConnection1.Connected := true;
executeButton.Enabled := true;
outputMemo.Text := ‘Connection established!’;
except
on E: EDatabaseError do
ShowMessage(‘Exception raised with message’ + E.Message);
end;
end;

If I compile the VCL app as 64 bit Windows Application, and run it and press the button1 then the code waits a little bit then the whole app closes. (Without giving any error message)

But if compile the Delphi application as Win32 application everything goes as expected without any error. Connection is established successfully.

Any idea,
Best Regards,

Share this post


Link to post
26 minutes ago, new_x said:

I have been trying to build a DB program by using sqlite. I downloaded.

...

Any idea,
Best Regards,

Probably some needed DLL which is not on your system (or incorrect version), can you see something in the windows event viewer (Windows -> Application logs) ?


or try to run it from a seperate cmdline instance, maybe you then see some error message? 

 

or try to trace what files are tried to be loaded using procmon (from sysinternals).

 

Share this post


Link to post

If you do want to use the latest version of SQLite, make sure to change the EngineLink property of your TFDPhysSQLiteDriverLink component to slDynamic and  put the SQLite DLL in the same directory as the application exe.

Share this post


Link to post

I used the FireDAC and everything seemed to be okay now. Thanks for your kind replies.  By the way there was not any logged event in windows event viewer (Windows -> Application logs) 

 

Best Regards,

Share this post


Link to post

Thank you for your replies. I decided to use FireDAC components and now there is no error. Best regards,

  • Like 1

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×