help using SQLite3 in-memory databases (through DBI)

J

Jean-Denis Muys

Hello,

I initially posted this in comp.lang.perl.modules, and then I realized
it may not have been the right place. I apologize for the cross
posting.

I am quite a newbie, and maybe this is easy, but I tried to google for
it for quite a long time to no avail. This may be at least partially
because it's not easy to have Google accept colons in search strings.
Anyhow, here goes:

I want to use SQLite3 from my Perl code. I use DBI, just because it's
seems the no-brainer choice.

My code uses a temporary database and works fine with a regular DBI
connect statement:
my $dbh = DBI->connect("dbi:SQLite:dbname=DBItest.db","", "",
{ RaiseError => 1, AutoCommit => 1 });

Now I want to test it with in-memory databases, that SQLite3 creates
when it is given as the database name the special string ":memory:"

my $dbh = DBI->Connect('dbi:SQLite:dbname=:memory:'); #
in-memory database

However, this doesn't work, and I crash on that connect statement
with
the following error message

Can't locate auto/DBI/Connect.al in @INC (@INC contains: /Volumes/
BLeopard/Applications/TextMate.app/Contents/SharedSupport/Bundles/
Perl.tmbundle/Support /System/Library/Perl/5.8.8/darwin-thread-
multi-2level /System/Library/Perl/5.8.8 /Library/Perl/5.8.8/darwin-
thread-multi-2level /Library/Perl/5.8.8 /Library/Perl /Network/
Library/
Perl/5.8.8/darwin-thread-multi-2level /Network/Library/Perl/5.8.8 /
Network/Library/Perl /System/Library/Perl/Extras/5.8.8/darwin-thread-
multi-2level /System/Library/Perl/Extras/5.8.8 /Library/Perl/5.8.6 /
Library/Perl/5.8.1 .) at /Volumes/Prune/DBItest.pl line 26

Again, to me the error message is rather puzzling as the exact same
code works in the case of a filename with no colons.

My hypotheses is that maybe the colons are screwing the connect
statement, since the connect statement itself uses colons as a
separator.

Either way, everything I tried failed, including silly things like
varying additional connect parameters or string delimitors.

Does DBI support in-memory SQLite3 databases? If so, how? Otherwise,
are there any alternative?

My configuration: MacOS X 10.5.6, Perl 5.8.8, DBI 1.5.2.

Many many thanks,

Jean-Denis
 
J

Jean-Denis Muys

My code uses a temporary database and works fine with a regular DBI
connect statement:
        my $dbh = DBI->connect("dbi:SQLite:dbname=DBItest.db","", "",
{ RaiseError => 1, AutoCommit => 1 });

Now I want to test it with in-memory databases, that SQLite3 creates
when it is given as the database name the special string ":memory:"

        my $dbh = DBI->Connect('dbi:SQLite:dbname=:memory:');       #
in-memory  database

However, this doesn't work, and I crash on that connect statement

My own followup: I upgraded all my CPAN modules. DBI is now at version
1.607, and DBD::SQLite is now at 1.14.

I get exactly the same behaviour.

Also, this page on SQLite web site suggests exactly what I am doing:
http://www.sqlite.org/cvstrac/wiki?p=PerlNotes

So I'm still lost.

If anybody out there had an idea...

Thanks again.

J-Denis
 
J

Jean-Denis Muys

Silly me. "Connect" should have been "connect". (lower case 'c').

I apologize for the waste of bandwidth and of your attention.

Jean-Denis
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,968
Messages
2,570,153
Members
46,699
Latest member
AnneRosen

Latest Threads

Top