Kodi Community Forum

Full Version: Accessing the database using sqlite or PHP?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I would like to write some tools to work with the data in XBMC's database files. I'm having trouble opening the database files under Linux though.

I made a backup copy of MyVideos34.db and then tried to open it using sqlite, but I get the following error:

Code:
sqlite MyVideos34.db
Unable to open database "MyVideos34.db": file is encrypted or is not a database

Trying to open the file using a simple PHP script to call "sqlite_open" gives the same error as well.

XBMC itself (under Linux) doesn't have any problems using the database and I can access it fine using SQLiteSpy under Windows.

Is there anything I need to do with the database file before I can open it using sqlite?
do you have +r on the file? is the file 0 byte? we can't guess, but in general you can surely sqlite the db. maybe you have sqlite2 on your box? we use sqlite3
Yep, SQLite 2 vs 3 is the problem. Ubuntu (even the latest 9.04) still uses SQLite 2. I downloaded SQLite 3 from sqlite.org and was able to open it. Now I need to find a SQLite 3 PHP extension.

Thanks!

EDIT: I see there is a "sqlite3" package in the repositories. I'll give that a try. Hopefully there is a PHP one too.
I think that ADOdb SQL database abstraction layer API support in XBMC would be very interested to have for tools like you describe:
http://forum.xbmc.org/showthread.php?tid=29107

The problem is, as usual, getting a developer with the time, interest, and skill to code this and submit a patch.

Sad