Recent

Author Topic: Zeos SQLite application "SQL Error: library routine called out of sequence"  (Read 25151 times)

seaton

  • New Member
  • *
  • Posts: 48
G'day one and all,

I'm developing a small sqlite application for windows 32 with the Zeos DB components.  When I deploy my application onto any machine other than my development pc I get the above error on startup.  I'm using Inno to create my setup file to deploy my application.

If run my application either via Lasarus IDE or I deploy my application locally via the setup file on my development machine It runs successfully, no problems here.  

I thought it might be the sqlite3.dll location, currently I package the dll and it gets installed in the applications installation directory, right next to the .exe.  I've also tried copying the dll to system32 folder, but no difference.  

At the moment My application is basically a skeleton that shows existing data from the database file in tables, it has one active TZConnection and a few active TZTables that I set at run time, these are linked via their relavant datasets to my visual DB components, as I mentioned, all works on my development machine when executed, just not on any other.

I though it may be the application not able to locate the db file, but I set the file path at runtime and I can confirm it's locating the correct database file at run time on my development machine from it's deployed directory.

My current test setup is a virtual stock standard windows XP SP3 install, I've also tried installing on a seperate physical PC, same error reported on both.

Regards,

Stephen...

jixian.yang

  • Full Member
  • ***
  • Posts: 173
Is the sqlite3.dll compiled by youself?

jixian.yang

  • Full Member
  • ***
  • Posts: 173
If it is compiled by VC, the runtime library should be installed.

seaton

  • New Member
  • *
  • Posts: 48
No the dll is the pre-compiled binary direct from the sqlite d/l site

seaton

  • New Member
  • *
  • Posts: 48
If it is compiled by VC, the runtime library should be installed.

Ok that makes sense, I'll need to check how it has been compiled.   What does everyone else use for their pre-compiled DLL, is there a statically linked version without the need to re-distribting the VC runtimes?

I'll try installing the VC runtimes to see if it resolves the error, then take it from there.

Cheers,

Stephen...
« Last Edit: February 10, 2011, 12:53:18 am by seaton »

seaton

  • New Member
  • *
  • Posts: 48
Just tried the VC runtimes installed on my test machine and makes no difference.

stephen...

jixian.yang

  • Full Member
  • ***
  • Posts: 173
Is there thread in the program? Did you try Lazarus local database component?

http://www.sqlite.org/cvstrac/wiki?p=LibraryRoutineCalledOutOfSequence

jixian.yang

  • Full Member
  • ***
  • Posts: 173
Is the installation path the full alphanumeric letters.

seaton

  • New Member
  • *
  • Posts: 48
Is there thread in the program? Did you try Lazarus local database component?

http://www.sqlite.org/cvstrac/wiki?p=LibraryRoutineCalledOutOfSequence

No threading enabled, I have a single TZConnection pointing to the database anbd 8 TZTables pointing to the relevant tables, on my form I have grids using datasources that have these tables as their datasets, no custom SQL queries at the moment as Its really just a skeleton at the moment with basic functionality.  

All these controls reside in a datamodule which is the first form to be loaded, the next is my main form, every other form is non-autoload.  

From the few bits of information I could find on google relating to this error there seem to be some problems in a transaction not commiting after, while I don't have any transactions I have disabled the autocomit on the TZConnection to see if it made a difference, still the same problem.

I havent tried the lazarus local database component, but will do after I finish this post.  The strange thing is that it all works on my development machine, your previous post about the VC runtimes made sense as I would have these installed on my development machine and not on my test machine, it's as though something is missing from my test machine.

Stephen...
« Last Edit: February 10, 2011, 08:27:02 am by seaton »

seaton

  • New Member
  • *
  • Posts: 48
Is the installation path the full alphanumeric letters.

yes fairly straight forward c:\program files\myapp\

seaton

  • New Member
  • *
  • Posts: 48
Re: Zeos SQLite application "SQL Error: library routine called out of sequence"
« Reply #10 on: February 10, 2011, 10:55:33 am »
Ok I have solved this problem after much head scratching....

I ended up creating a completly new app and used this as a basis to find the problem. 

Initially I received the exact same problem on the single table app where I intentionally did not put in my database onCreate code where I set the database file location and then connect.

I then copy and pasted the code from my non working application, low and behold the test app started working.

Code: [Select]
       
ZRallylogDB.Database := ExtractFilePath(Application.ExeName) + 'db\rallylog.s3db';
ZRallylogDB.Protocol := 'sqlite-3';
ZRallylogDB.Connect;


If the code is exactly the same then it had something to do with my project so I then double checked my projects options against my working test and there were a couple of settings here that were different so I corrected.

After recompiling I then started receiving the same error code in my development environment as I did on my test machine when running the installed application, which made everything easy to find.  I just put a breakpoint on my database intialiazation code.

In the end the error I was getting was to do with TZConnection component being enabled at design time and my designtime database files selected in the component, even though I  was setting up the connection in my applications dataforms onCreate method, it appears it was tring to to connect to the non existant database file when the form was created, before the onCreate, so I had to disable my TZConnection at design time (along with my compiler settings) now all appears to be working on my deployment test machine.

Stephen...

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11383
  • FPC developer.
Re: Zeos SQLite application "SQL Error: library routine called out of sequence"
« Reply #11 on: February 10, 2011, 11:32:58 am »

In the end the error I was getting was to do with TZConnection component being enabled at design time and my designtime database files selected in the component, even though I  was setting up the connection in my applications dataforms onCreate method, it appears it was tring to to connect to the non existant database file when the form was created, before the onCreate, so I had to disable my TZConnection at design time (along with my compiler settings) now all appears to be working on my deployment test machine.
 

Thanks for the detailed feedback. It will make things easier for other people in the future.

Actually I also had this problem when I started with Zeos (but then with postgresql), but I didn't connect the dots till your feedback. It might be wise to propagate such info back to ZEOS for their FAQs.

seaton

  • New Member
  • *
  • Posts: 48
Re: Zeos SQLite application "SQL Error: library routine called out of sequence"
« Reply #12 on: February 11, 2011, 02:51:37 am »
Thanks for the detailed feedback. It will make things easier for other people in the future.

Actually I also had this problem when I started with Zeos (but then with postgresql), but I didn't connect the dots till your feedback. It might be wise to propagate such info back to ZEOS for their FAQs.

Will do :)

Actually upon reading some of the ZeosLib api docs, it appears the DesignConnection in the TZTable component when enabled will disable the connection on recompile so this sort of thing won't happen.
« Last Edit: February 11, 2011, 08:28:17 am by seaton »

calebs

  • Full Member
  • ***
  • Posts: 190
Sorry to revive this old post, but i've created an app that worked fine, then moved the entire folder to another path and the app starts to giving this error ("SQL Error: library routine called out of sequence" ).
After long head scratch and reading this post, clicked the tzconnection component and realise that the path for the database was wrong (was pointing to the old path) in the database property.
Removed all the path and just leaved the name of the file of database and worked again.
Maybe this is useful for somebody.

 

TinyPortal © 2005-2018