[EMAIL PROTECTED] wrote: > I use a c++ program to > open a connection to my database with no issues, but when trying to > exec any sql statements after that, i get SQLITE_BUSY (i.e. database > is locked). > > Even if I change the sql statement, I always get SQLITE_BUSY. This is > frustrating because this is a single-threaded app, so I have no idea > why the database would be locked, especially before I have called any > write operations to it (i.e. before a CREATE, INSERT, etc). Any ideas > as to why this is happening and how I can fix it? Thanks.
I don't see anything obviously wrong with your code. I suspect you may have another instance of your code running or possibly an sqlite command shell with the same file open. Others have also had issues with things such as antivirus software that opens the database file after it's created but before SQLite tries to get a write lock. You should try disabling any antivirus software. You should also probably look at changing your code to use the new prepared staetment API (see http://www.sqlite.org/capi3.html for more info). The callback feature of the sqlite_exec API is retained for backwards compatibility, but it is not the best way to read data out of a database. The SQLite quickstart documentation should be revised to use the preferred interface, but it has not been done yet. In any event you do not need a callback function to execute a "CREATE TABLE" statement (but it should not cause a problem either). HTH Dennis Cote _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users