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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

connected at database of prog perl

Status
Not open for further replies.

dontu

Programmer
Mar 17, 2006
14
RO
Hi all,
I want connect a database of this program :

#!/usr/bin/perl -w
use DBI;

$user ="romeo";
$driver = "DBI:mysql:romeo";
$password = "123456";

$dbh =DBI->connect($driver,$user,$password) or die "\n Eroare ($DBI::err): $DBI::errstr\n";

$first = "firstname";
$second = "lastname";

$statement = $dbh->prepare("SELECT $first, $second FROM users") or die "\n Eroare ($DBI::err):$DBI::errstr\n";

$statement->execute or die "\n Eroare ($DBI::err): $DBI::errstr\n";

print "\n \n Returnare $first si $second \n";

while(($firstname, $lastname) = $statement->fetchrow_array){
print "$firstname\t $lastname\n";

}

$statement->finish;

$dbh->disconnect;

#####################################
the problem is this error:
"DBD :: mysql :: st execute failed: Table 'romeo.users' doesn't exist at db line 14 ERROR (1046):Table:'romeo.users' doesn't exist"

the fields exist in this database, and datasource and user and password is declare

best regards,
dontu
 
Since you're using the database "romeo" (implied by the connection string "DBI:mysql:romeo"), the table must be located in that database.
 
So,
in database "romeo" it must exist this table (users)?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top