Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Trying to use DBI::SQLite 1

Status
Not open for further replies.

jcarrott

Programmer
May 28, 2009
130
US
I have used DBI::Oracle in the past, but now I need to use DBI::SQLite and it seems the connection structure is different.

Perl:
#### program variables

$dbsys     = "spwdclwsntdb1";
$user      = "lawsonpf";
$pass      = "##########";
$dsn       = "DBI:SQLite:dbname=$dbsys";

use DBI;

$dbh=DBI->connect($dsn, $user, $pass) or die;

$sth = $dbh->prepare("SELECT * FROM EMPLOYEE")
        or die "Couldn't prepare statement: " . $dbh->errstr;

I changed the password to all #'s.

The error I am getting is that it cannot find the table EMPLOYEE. The table EMPLOYEE is under DEV. I don't see where to put that.

In Oracle I used dev.EMPLOYEE, I tried that in SQLite and it can not find the table.

There are no errors on the connection, just the prepare.

Does anybody see what I am doing wrong?
 
I forgot to mention that this is a Windows/SQL machine and in the past I was working on a Unix/Oracle machine.
 
And have you tried to use the qualified name for the table in your select i.e
Code:
SELECT * FROM [COLOR=red]DEV.[/color]EMPLOYEE
???
 
add some debug commands.

Is DBI:SQLite part of DBI or do you have to instantiate it other than use DBI?

use warnings;

Do you have any special characters in "$pass"?

$dbh=DBI->connect($dsn, $user, $pass) or die "print $!\";
 
I tried dev.employee and got the same result.

I do have 2 $$ characters in $pass and I have asked for a password with no special characters.
 
My database is DEV and my server is spwdclwsntdb1
 
This is closed, the problem was that SQL was not setup correctly.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top