我正在尝试使用perl脚本连接到mssql数据库。
我的代码如下:
#!/home/fds/freeware/perl/bin/perl
use DBI;
my $user = "username";
my $pass = "password";
my $server = "server_name";
my $database_name = "db";
my $DSN = "driver={SQL Server};server=$server;database=$database_name;uid=$user;pwd=$pass";
my $DBH = DBI->connect("DBI:ODBC:$DSN") or die "Couldn't open database: $DBI::errstr\n";
当我运行该脚本时,我收到以下错误:
install_driver(ODBC)失败:无法在@INC中找到DBD / ODBC.pm(@INC 包含: /export/fds/Linux_RHEL6_x86_64/lang/perl/FDSperl5.12-CPANmodules-5.12-20160408/lib/perl5/x86_64-linux-thread-multi /export/fds/Linux_RHEL6_x86_64/lang/perl/FDSperl5.12-CPANmodules-5.12-20160408/lib/perl5 /export/fds/Linux_RHEL6_x86_64/lang/perl/5.12/lib/site_perl/5.12.5/x86_64-linux-thread-multi /export/fds/Linux_RHEL6_x86_64/lang/perl/5.12/lib/site_perl/5.12.5 /export/fds/Linux_RHEL6_x86_64/lang/perl/5.12/lib/5.12.5/x86_64-linux-thread-multi /export/fds/Linux_RHEL6_x86_64/lang/perl/5.12/lib/5.12.5。)at(eval 3)第3行。也许DBD :: ODBC perl模块还没有完全 已安装,或者可能是ODBC的大写字母'不对。 可用的驱动程序:AnyData,CSV,DBM,ExampleP,Excel,File,Gofer, Mock,Multi,Multiplex,PgPP,Proxy,SQLite,Sponge,Wire10,mysql, mysqlPP。在test_connect第12行
有人可以让我知道如何继续吗?
答案 0 :(得分:0)
当我将以下环境变量导出到相应的值时,此错误得到修复:LD_LIBRARY_PATH& PERL5LIB