Carl,

The connection doesn't get its username and password attributes from the
DSN, so that wouldn't matter. It does, however get its other connection info
from the DSN.

If you have copied your code directly, then you have an error.... you wrote

> $dbh = DBI->connect("dbi:ODBC:LocalServer", "user", "password". \%attr)
>     or die "Can't connect to DataBase: ", $DBI::errstr, "\n";

this shows you concatenating the password with the address of the %attr
hash. This is probably why our password is wrong. It would be coming in as
passwordHASH(0x1246) or something.

Also if you are using the LocalServer you may want to make another DSN
specifically for your machine's ip address instead of using LocalServer DSN.

Hope this helps

Hugh J. Hitchcock
Programmer / Developer


        my $dbh = DBI->connect('DBI:ODBC:MyDSN','sa','pass')
                or die "Couldn't connect to database: " . DBI->errstr;



> -----Original Message-----
> From: Carter A. Thompson [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, August 16, 2001 1:59 PM
> To: DBI-Users
> Subject: SQL Server Problem.(SQL-28000)
>
>
> Hello,
>
> I'm a newbie here and have a question regarding the use of
> DBI::ODBC with SQL Server.  I've checked the mail archives
> and seen others with the same problem but have yet to
> come across the solution.
>
> Here's what I'm doing: (note: actual user name and password have been
> changed here).
>
> use DBI;
> my %attr = (
>     PrintError => 1,
>     RaiseError => 1
>     );
>
> $dbh = DBI->connect("dbi:ODBC:LocalServer", "user", "password". \%attr)
>     or die "Can't connect to DataBase: ", $DBI::errstr, "\n";
>
> ...
>
> Here's the error:
>
> DBI->connect(LocalServer) failed: [Microsoft][ODBC SQL Server Driver][SQL
> Server]Login failed for user 'user'. (SQL-28000)(DBD: db_login/SQLConnect
> err=-1)
> Can't connect to DataBase: [Microsoft][ODBC SQL Server Driver][SQL
> Server]Login failed for user 'user'. (SQL-28000)(DBD: db_login/SQLConnect
> err=-1)
>
>
> I've done the following:
>
> 1) Verified that a valid DSN exists for LocalServer.
> 2) Verified that user and password are configured properly in the DSN.
> 3) Verified that the SQL Server Database is correct.
> 4) Tested the ODBC Data Source is correct through the ODBC Administrator.
>
> I'm using Win2K and SQL Server 7.
>
> I'm trying to avoid using the WIN32:ODBC but I have used it successfully.
>
> Thoughts, Comments, Dirty Remarks?
>
> Thanks,
>
> Carter.
>
> --
> Carter A. Thompson
> Lead Release Engineer
> Voxeo Corporation
> http://www.voxeo.com
> (831) 461-4925
>
>

Reply via email to