Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

geoff (2013)

geoff
  reversethis-{gro ... om} {ta} {ffoeg}
http://www.modperlcookbook.org/

see http://www.modperlcookbook.org/~geoff/ [modperlcookbook.org] for personal information, links to presentations, GPG key, and so on.

Journal of geoff (2013)

Monday October 25, 2004
03:13 AM

sqlite in perl and php

[ #21495 ]
so I'm trying to use both DBD::SQLite and php (5.0.2) to access the same sqlite database. depending on who creates the database file I get

file is encrypted or is not a database

errors - in php if I use perl to create the file and perl if I use php. some initial googling seems to think that it's because the two libaries are using different sqlite versions, but I'm not entirely sure.

please tell me that someone has seen this before and there is an obvious fix to the compatibility issues.

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.
  • That sounds like a probably reason. SQLite 2.x and 3.x are not compatible qua databasefile.

    I don't know what version of SQLite PHP 5 is using, but checking for Perl is quite easy, according to the changes file [cpan.org], DBD::SQLite started using SQLite 3 starting with DBD::SQLite version 1.00. So, whatever version it is you have, try installing the latest one of the other generation.

    I wish Perl had a better way to have different generations of modules live together, but I think the best you can do in order not to

    • And thus the reason for DBD::SQLite2 [cpan.org]. From the README for DBD::SQLite2,

      Note: DBD::SQLite2 is the old version of DBD::SQLite, and embeds version 2.x.x of the sqlite library. The current version of DBD::SQLite embeds version 3 (or possibly later if I forget to update this file). This release is designed to allow you to have both versions installed on the same system.
      • yup, that was it. thanks!
      • The SQLite 3.0 thread just occured on php-internals. It'll happen, but not before ApacheCon. :)

        -adam
        • cool.

          while this is neither a php nor perl concern, I was able to put my finger on why this all felt so strange to me this week at nyphp: if versions 2 and 3 databases are not compatible, I would expect that a version 2 client would bomb, however I would expect a version 3 client to say "whoa - you're using a version 2 database." the way it is now, you get this cryptic "file is encrypted" error in both directions, which is very user unfriendly.
      • I just came across this same problem today, and this post helped me as well. The error that the SQLite libraries provide is certainly a bit cryptic and not helpful at all. Well, it is helpful when running it through Google, but we really shouldn't have to do that.