DBD :: MySql初始化失败:使用生物信息学工具OrthoMCL时,无法通过包“DBD :: MySql”找到对象方法“driver”

时间:2013-11-07 14:33:57

标签: mysql perl

我正在尝试在Ubuntu 12.04上运行生物信息学工具OrthoMCL。该工具需要MySQL数据库进行数据处理。我的SQL数据库运行良好,版本为5.5.34。 OrthoMCL包含一些运行到命令行的Perl脚本。当我运行使用下面的模块的时候,我得到了以下错误:

mark@CMBIPC34:~/Bureaublad/OrthoMCL/orthomclSoftware-v2.0.9/bin$ perl orthomclLoadBlast '/home/mark/Bureaublad/my_orthomcl_dir/orthomcl.config' '/home/mark/Bureaublad/my_orthomcl_dir/compliantFasta/similarSequences.txt'
DBD::MySql initialisation failed: Can't locate object method "driver" via package "DBD::MySql" at /usr/local/lib/perl/5.14.2/DBI.pm line 821, <F> line 14.

Perhaps the capitalisation of DBD 'MySql' isn't right. at /home/mark/Bureaublad/OrthoMCL/orthomclSoftware-v2.0.9/bin/../lib/perl/OrthoMCLEngine/Main/Base.pm line 56

模块是:

use DBI;
use FindBin;
use lib "$FindBin::Bin/../lib/perl";
use OrthoMCLEngine::Main::Base;
use strict;

当我运行此脚本来测试已安装的模块时

use DBI;
print "Available DBI Drivers and Data Sources:\n\n";
@drivers;
    my @drivers=DBI->available_drivers('quiet');
    my @sources;
    foreach my $driver (@drivers) {
        print "$driver\n";
        @sources=eval { DBI->data_sources($driver) };
        if ($@) {
            print "\tError: ",substr($@,0,60),"\n";
        } elsif (@sources) {
            foreach (@sources) {
                print "\t$_\n";
            }
        } else {
            print "\tNo known data sources\n";
        }
    }

我得到了这个结果:

Available DBI Drivers and Data Sources:

DBM
    DBI:DBM:f_dir=Verwijzing naar Stage-documenten
    DBI:DBM:f_dir=my_orthomcl_dir
    DBI:DBM:f_dir=Dropbox
    DBI:DBM:f_dir=OrthoMCL
    DBI:DBM:f_dir=MySQL
    DBI:DBM:f_dir=.
    DBI:DBM:f_dir=mcl-12-068
ExampleP
    dbi:ExampleP:dir=.
File
    DBI:File:f_dir=Verwijzing naar Stage-documenten
    DBI:File:f_dir=my_orthomcl_dir
    DBI:File:f_dir=Dropbox
    DBI:File:f_dir=OrthoMCL
    DBI:File:f_dir=MySQL
    DBI:File:f_dir=.
    DBI:File:f_dir=mcl-12-068
Gofer
    No known data sources
Multiplex
    No known data sources
MySql
    Error: DBD::MySql initialisation failed: Can't locate object method
Proxy
    No known data sources
Sponge
    No known data sources
mysql
    DBI:mysql:information_schema

当我在命令行中尝试下载文件夹DBD-mysql-4.025时,我收到此错误:

perl Makefile.PL

没有错误

/usr/bin/ld: cannot find -lmysqlclient
collect2: ld gaf exit-status 1 terug
make: *** [blib/arch/auto/DBD/mysql/mysql.so] Fout 1

进行测试

与make

相同的错误

make install

与make

相同的错误

我也试过通过cpan [1]&gt;进行安装。安装DBD :: mysql并收到此错误:

/usr/bin/ld: cannot find -lmysqlclient
collect2: ld gaf exit-status 1 terug
make: *** [blib/arch/auto/DBD/mysql/mysql.so] Fout 1
  CAPTTOFU/DBD-mysql-4.025.tar.gz
  /usr/bin/make -- NOT OK
Running make test
  Can't test without successful make
Running make install
  Make had returned bad status, install seems impossible
Failed during this command:
 CAPTTOFU/DBD-mysql-4.025.tar.gz              : make NO

在哪里可以找到-lmysqlclient,我在计算机的硬盘上找不到该文件。

运行此测试perl脚本时不会出现此问题:

 #!/usr/bin/perl -w
 use DBI;
 $dbh = DBI->connect('dbi:mysql:orthomcl','root','')
 or die "Connection Error: $DBI::errstr\n";
 $sql = "show tables";
 $sth = $dbh->prepare($sql);
 $sth->execute
 or die "SQL Error: $DBI::errstr\n";
 while (@row = $sth->fetchrow_array) {
 print "@row\n";
 }

在这种情况下,数据库OrthoMCL的表格将正确显示,没有任何错误消息。

我希望有人能帮我解决这个问题。

2 个答案:

答案 0 :(得分:4)

“也许''MySql'的大写不正确。”

您的connect声明是否使用了正确的大小写?

$dbh = DBI->connect("dbi:mysql:...", ...);

答案 1 :(得分:0)

最后我找到了解决方案。问题出在配置文件中:

dbConnectString=dbi:MySql:orthomcl:localhost:3306

必须是

dbConnectString=dbi:mysql:orthomcl:localhost:3306