Dear SQL gurus - I have been using SQLite for several years and love it. Currently it is being used on a small embedded Linux device.
Once in a while when we power on the device and start my application, this query fails: "SELECT storage_enum, mode, GPSDisplayDMS, UserRealID, UserEffID FROM Settings;" with the reason "unable to open database file" I suspect something didn't get closed properly when the unit powered off. Weird: 1. If I copy the db file to my PC, it opens and reads just fine. 2. If I just make a copy of it on the device itself (same folder and everything), then I can query the *copy* of the file just fine. sqlite3_open() always succeeds and returns SQLITE_OK. The failure is when sqlite3_exec() tries to run. Then we sqlite3_close() the db. I looked at the source code to see where CANTOPEN is returned and thought the open() was most likely, but a small prg to see if the db would open() always succeeds. open() at least for modes RDWR and RDONLY always succeed on the "unopenable" db file: fd = open(db_filename, O_RDWR); fd = open(db_filename, O_RDONLY); Google and Sqlite.org suggested: sqlite3_file_control(db, "main", SQLITE_LAST_ERRNO, &errno_value); so I added that after the call to sqlite3_exec() failed. That returned SQLITE_OK, but to my dismay, errno_value was 0 when that returned! Then I tried: sqlite3_config(SQLITE_CONFIG_LOG, &log_func, (void *)dbname) which returns a several different non-zero (error) values dep on where I call it, so logging is out too. There's plenty of disk space left and I don't see anything wrong with permissions (the copy in the same folder works fine). Any suggestions, or general thoughts on recovery? Thanks a lot Brad Brancke _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users