这是我的问题,我的代码很简单,连接到数据库,执行一个查询并检索一些行
我可以连接到数据库,但问题是当我想要执行查询时,这里的代码是
my $url = "jdbc:sqlserver://x.x.x.x\\db";
my $dbh = DBI->connect("dbi:JDBC:hostname=localhost;port=$opt_P;url=$url",
test, xxx, {RaiseError => 4, PrintError => 4});
$query = "SELECT setting FROM pg_catalog.pg_settings
WHERE name = 'server_version'";
$sth = $dbh->prepare ($query) or die "prepare failed\n";
print "Got here without dying2\n";
$sth->execute( ) or die "unable to execute query $query error $DBI::errstr";`我得到了这个错误
DBD::JDBC::st执行警告: ERROR:语法错误在或接近“返回”位置: 74 at ./test
奇怪的是,它正在使用dbi:odbc和jdbc正在使用java和postgresql,而不是perl :(
发布于 2016-09-22 12:44:47
此版本的JDBC42 Postgresql驱动程序9.4.1211解决了问题
https://stackoverflow.com/questions/37747553
复制相似问题