开发者

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

开发者 https://www.devze.com 2023-04-06 09:39 出处:网络
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

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.


Does it work from command line?

> mysql -u username -ppassword 

mysql> select * from RegenMedline.user_tables
0

精彩评论

暂无评论...
验证码 换一张
取 消