Author Topic: [SOLVED]SQLdb and SQLite3  (Read 2981 times)


  • Newbie
  • Posts: 2
[SOLVED]SQLdb and SQLite3
« on: August 02, 2012, 08:52:28 pm »
I am on a mac running Snow leopard 10.6.8, using FPC 2.6, Lazarus 1.0 and SQLite 3.6.12
I wanted to try setting up a connection to a SQLite database I located in the folder where the project directory is located.
I have tried this with TSQLite3Dataset and it connected.

Since this was only a test run I did not use a datamodule but instead just dropped items on Form1.
TSQLite3Connection where I set
  Database Name to  ContactsDataset
TSQLTransaction  where I set
  Database          to SQLite3Connection1
  Name               to  SQLTransaction1
I could then set on TSQLite3Connection
  Transaction  to SQLTransaction1

both of the above could then have active/Connected properties set to true with no message popping up.

i then added TSQLQuery
  set Database to SQLConnection1
  and Transaction to SQLtransaction1
  and SQL to SELECT * FROM Contacts

But when I try to set Active to True i get the message

no such table Contacts

however using the Sqlite3 commandline interace in Terminal I can see that this table exists.

Since I have actually tried this on a Win7 32 bit unit, a Linux 64 bit unit in addition to my macbook clearly it is something that I am probably doing incorrectly but i am lost as to what.

Any thoughts or points?

Thanks in advance

« Last Edit: August 03, 2012, 10:17:47 am by jaylm3 »


  • Hero Member
  • *****
  • Posts: 5740
  • Add to the wiki - it's free ;)
    • FPCUp, PaperTiger scanning and other open source projects
Re: SQLdb and SQLite3
« Reply #1 on: August 03, 2012, 12:04:35 am »
Haven't read your post in detail, but just a quick remark.

Sqlite creates the database for you if it doesn't exist. Often you'll therefore get the error "can't find table blah" when in reality sqlite couldn't find your database.
Perhaps there's something wrong with the location where sqlite is looking for the database file...

Want quicker answers to your questions? Read

Open source including papertiger OCR/PDF scanning:

Lazarus trunk+FPC trunk x86, Windows x64 unless otherwise specified


  • Hero Member
  • *****
  • Posts: 8143
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: SQLdb and SQLite3
« Reply #2 on: August 03, 2012, 02:46:53 am »
TSQLite3Connection where I set
  Database Name to  ContactsDataset
Try using absolute path, even if the ContactsDataset file (are you sure this is the filename?) is in the current directory.


  • Newbie
  • Posts: 2
[SOLVED] Re: SQLdb and SQLite3
« Reply #3 on: August 03, 2012, 10:13:11 am »
Big Chimp & Leledumbo;

Many thanks for your assistance.
Filename was correct but it needed the pathname.
Once I put that in it worked.
I thought that if it could not find the file it would create the file and thus I would know that it was a location issue.

« Last Edit: August 03, 2012, 10:16:47 am by jaylm3 »