smandape
smandape

Reputation: 1043

DBD::mysql::st execute failed: Table '' doesn't exist

I am sorry if this may be a silly question for you all,but I don't know what to do. I am trying to connect to a local database using perl. When I try to run the command I get below error

DBD::mysql::st execute failed: Table 'RegenMedline.user_tables' doesn't exist at Medlineparser.pl line 639.

My line 639 is something like this:

$main::dbh = DBI->connect("dbi:mysql:databasename", 
                       $main::user="username", 
                       $main::password="password",
                       {PrintError => 1,
                        RaiseError => 1,
                        AutoCommit => 1})
                        or die "Can't connect to database: $DBI:errstr\n"; 

my $sth = $main::dbh->prepare("
                SELECT table_name
                FROM user_tables");

$sth->execute();

while (my ($table_name) = $sth->fetchrow_array()){
  print "table_name = $table_name\n";
}

I hope this snippet helps and I have put my question in right way. Let me now if I need to give more information. Any help is greatly appreciated.

Upvotes: 1

Views: 4823

Answers (1)

Andreas
Andreas

Reputation: 2309

Does it work from command line?

> mysql -u username -ppassword 

mysql> select * from RegenMedline.user_tables

Upvotes: 2

Related Questions