PlPerl ODBC connect error question?

From: tuanhoanganh <hatuan05(at)gmail(dot)com>
To: PostgreSQL <pgsql-general(at)postgresql(dot)org>
Subject: PlPerl ODBC connect error question?
Date: 2011-01-05 10:36:48
Message-ID: AANLkTi=R5VJMS74e59mQpCnE0OUTYcfJVk9_7bxp_38e@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Can PLPerl make ODBC connect.
I have perl test connect. It work well
use DBI;
my $h = DBI->connect(
'dbi:ODBC:DRIVER=SQL
Server;Server=127.0.0.1;Database=TEST;Uid=sa;Pwd=abc123ABC;Port=1433',
'sa',
'abc123ABC',
{ AutoCommit => 1, RaiseError => 1, }
) or die "Did not connect to db.";
print join(',', $h->tables);

But in PLPerlu it has error

CREATE OR REPLACE FUNCTION test_connection()
RETURNS void AS
$BODY$
use DBI;
my $dbh = DBI->connect(
'dbi:ODBC:DRIVER=SQL
Server;Server=127.0.0.1;Database=TEST;Uid=sa;Pwd=abc123ABC;Port=1433',
'sa',
'abc123ABC',
{ AutoCommit => 1, RaiseError => 1, }
);

if ($DBI::errstr) {
die <<ERR;
Could not connect to database
$DBI::errstr
ERR
}
RETURN;
$BODY$
LANGUAGE plperlu VOLATILE
COST 100;
ALTER FUNCTION test_connection() OWNER TO postgres;

AND when i execute function

SELECT test_connection();

Here is error

ERROR: Could not connect to database
[Microsoft][ODBC SQL Server Driver][SQL Server]Changed database context to
'TEST'. (SQL-01000)
[Microsoft][ODBC SQL Server Driver][SQL Server]Changed language setting to
us_english. (SQL-01000) [state was 01000 now 01S00]
[Microsoft][ODBC SQL Server Driver]Invalid connection string attribute
(SQL-01S00)
SQL state: XX000
Context: PL/Perl function "test_connection"

Browse pgsql-general by date

  From Date Subject
Next Message Craig Ringer 2011-01-05 10:50:11 Re: UUID column as pimrary key?
Previous Message Radosław Smogura 2011-01-05 08:31:51 Re: UUID column as pimrary key?