Thread: Failing ODBC connection

Failing ODBC connection

From
Don Isgitt
Date:
Hello,

I am using pg 7.2.4 on a Linux host, and have recently written a
Perl/Perl:Tk application that works as expected when run from the local
host. Unfortunately, the proposed users are on Windows machines, and
when I try to run the same application there, I get the following error:

DBI connect('pg-gds2','HASH(0x1f03458)',...) failed: FATAL 1:  user
"HASH(0x1f0
458)" does not exist
 (SQL-28000)
[Microsoft][ODBC Driver Manager] The driver doesn't support the version
of ODBC
behavior that the application requested (see SQLSetEnvAttr).
(SQL-01000)(DBD: d
_login/SQLConnect err=-1) at C:\Perl\code\db_edit.pl line 200
Tk::Error: Can't connect to: FATAL 1:  user "HASH(0x1f03458)" does not exist
 (SQL-28000)
[Microsoft][ODBC Driver Manager] The driver doesn't support the version
of ODBC
behavior that the application requested (see SQLSetEnvAttr).
(SQL-01000)(DBD: d
_login/SQLConnect err=-1)
 [\&main::bld_sql]
 Tk callback for .button
 Tk::__ANON__ at C:/Perl/site/lib/Tk.pm line 228
 Tk::Button::butUp at C:/Perl/site/lib/Tk/Button.pm line 111
 (command bound to event)

Relevant perl code is

  $dbh = DBI->connect("dbi:ODBC:pg-gds2",{AutoCommit=>0}) or die "Can't
connect to: $DBI::errstr\n";

pg-gds2 is an ODBC DSN; the ODBC driver version is 7.2.5.
I also tried replacing the DSN with all the parameters
(driver,server,host,uid,pwid) on the call line with the same results.

Just for the sake of completeness, I can ping the server and telnet to
the server from the Windows machine, and pgadmin2 also works perfectly
(does it use ODBC?)

pg_hba.conf is: (not connected to outside world!)

# TYPE     DATABASE    IP_ADDRESS    MASK               AUTH_TYPE
AUTH_ARGUMENT

local      all                                          trust
host       all         127.0.0.1     255.255.255.255    trust
host       all         10.0.1.0      255.255.255.0      trust



The perl (and Tk and DBD/DBI) were just downloaded from ActiveState.

I am not terribly literate in Windows, much less ODBC, so any help is
appreciated.

Thank you very much,

Don




Re: Failing ODBC connection

From
Don Isgitt
Date:
Never mind; simply adding the username and password as separate
parameters after the DSN part works. Strange to me, though, since the
DSN already contains that information.

Don Isgitt wrote:

> Hello,
>
> I am using pg 7.2.4 on a Linux host, and have recently written a
> Perl/Perl:Tk application that works as expected when run from the
> local host. Unfortunately, the proposed users are on Windows machines,
> and when I try to run the same application there, I get the following
> error:
>
> DBI connect('pg-gds2','HASH(0x1f03458)',...) failed: FATAL 1:  user
> "HASH(0x1f0
> 458)" does not exist
> (SQL-28000)
> [Microsoft][ODBC Driver Manager] The driver doesn't support the
> version of ODBC
> behavior that the application requested (see SQLSetEnvAttr).
> (SQL-01000)(DBD: d
> _login/SQLConnect err=-1) at C:\Perl\code\db_edit.pl line 200
> Tk::Error: Can't connect to: FATAL 1:  user "HASH(0x1f03458)" does not
> exist
> (SQL-28000)
> [Microsoft][ODBC Driver Manager] The driver doesn't support the
> version of ODBC
> behavior that the application requested (see SQLSetEnvAttr).
> (SQL-01000)(DBD: d
> _login/SQLConnect err=-1)
> [\&main::bld_sql]
> Tk callback for .button
> Tk::__ANON__ at C:/Perl/site/lib/Tk.pm line 228
> Tk::Button::butUp at C:/Perl/site/lib/Tk/Button.pm line 111
> (command bound to event)
>
> Relevant perl code is
>
>  $dbh = DBI->connect("dbi:ODBC:pg-gds2",{AutoCommit=>0}) or die "Can't
> connect to: $DBI::errstr\n";
>
> pg-gds2 is an ODBC DSN; the ODBC driver version is 7.2.5.
> I also tried replacing the DSN with all the parameters
> (driver,server,host,uid,pwid) on the call line with the same results.
>
> Just for the sake of completeness, I can ping the server and telnet to
> the server from the Windows machine, and pgadmin2 also works perfectly
> (does it use ODBC?)
>
> pg_hba.conf is: (not connected to outside world!)
>
> # TYPE     DATABASE    IP_ADDRESS    MASK               AUTH_TYPE
> AUTH_ARGUMENT
>
> local      all                                          trust
> host       all         127.0.0.1     255.255.255.255    trust
> host       all         10.0.1.0      255.255.255.0      trust
>
>
>
> The perl (and Tk and DBD/DBI) were just downloaded from ActiveState.
>
> I am not terribly literate in Windows, much less ODBC, so any help is
> appreciated.
>
> Thank you very much,
>
> Don
>
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 3: if posting/reading through Usenet, please send an appropriate
>      subscribe-nomail command to majordomo@postgresql.org so that your
>      message can get through to the mailing list cleanly
>
>