Forum Moderators: coopster & phranque

Message Too Old, No Replies

database connection problem

         

oldoldcat

5:06 am on Jan 10, 2006 (gmt 0)



I have a script that connects to ms sql server with DBI::ODBC. But this code works only for DBI 1.37 version, not for version 1.48. I get connection failed error and looks like the driver connection was not built. DBI was trying to login as the system user instead of the DB user. Any one has seen this problem before? What change from 1.37 to 1.48 could cause this problem? Thanks a lot.

my $dbh = DBI->connect("DBI:ODBC:driver={SQL Server};server=$dbHost;Database=$dbn;UID=$dbUsr;PWD=$dbPw") or die "could not connect to db, ", DBI->errstr, "\n";

Moby_Dim

7:42 am on Jan 10, 2006 (gmt 0)

10+ Year Member



Too many semicolons imho ;)

bennymack

4:12 pm on Jan 10, 2006 (gmt 0)

10+ Year Member



Sounds like the newer version is using %ENV for connection info for some reason.

Try:


print "\$ENV{$key}=$ENV{$key}\n" for my $key( keys %ENV );

And see if that system user isn't in there somewhere.

perl_diver

4:25 pm on Jan 10, 2006 (gmt 0)

10+ Year Member



you can try the DBI changes page on cpan and see if there is anything there that might help:

[search.cpan.org...]