SQLite - problem connecting to database (or doing a select)
From: Alex Hunsley (lardattardisdoteddotacdotuk_at_mailinator.com)
Date: 11/30/04
- Next message: Alex Hunsley: "Re: can't install DBD::mysql - missing mysql.h?"
- Previous message: Paul Lalli: "Re: can't install DBD::mysql - missing mysql.h?"
- Next in thread: Alan Mead: "Re: SQLite - problem connecting to database (or doing a select)"
- Reply: Alan Mead: "Re: SQLite - problem connecting to database (or doing a select)"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Tue, 30 Nov 2004 16:27:51 +0000
I've having a problem running a tiny snippet of test code that uses
SQLite to connect to a local database (I'm running xampp on my local
machine which includes mysql).
Firstly, just to demonstrate that I really do have a live database which
is running:
$ mysql -h 127.0.0.1
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 16 to server version: 4.0.20a-debug-log
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql> use pmaster;
Database changed
mysql> show tables;
+---------------------+
| Tables_in_pmaster |
+---------------------+
| campaigns |
| data |
| logging |
+---------------------+
3 rows in set (0.00 sec)
mysql>
Now, I've installed SQLite and am running this perl code:
----8<----
use DBI;
my $dbh = DBI->connect('dbi:SQLite:pmaster',
'', '') || die("problem: ".DBI->errstr);
$results = $dbh->selectall_arrayref('SELECT * FROM data');
print "results=".$results."\n";
----8<----
when I run this, the output is as follows:
$ ./sqlTest.pl
DBD::SQLite::db selectall_arrayref failed: no such table: data(1) at
dbdimp.c line 263 at ./sqlTest.pl line 24.
results=
No such table it says, yet clearly the database pmaster is there and
does contain a table called data (see the mysql monitor stuff at the top).
- Next message: Alex Hunsley: "Re: can't install DBD::mysql - missing mysql.h?"
- Previous message: Paul Lalli: "Re: can't install DBD::mysql - missing mysql.h?"
- Next in thread: Alan Mead: "Re: SQLite - problem connecting to database (or doing a select)"
- Reply: Alan Mead: "Re: SQLite - problem connecting to database (or doing a select)"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|