in reply to Trying to connect to a MsSql Database

Hi Streen,

Try:
#!/usr/bin/perl -w use strict; use DBI; my $dbhost = 'MUCSQL64'; my $dbuser = 'User'; my $dbpass = 'Password'; my $dbname = 'LotTracking'; my $dbh; #Database Handler my $DSN = 'driver={SQL Server};Server=$dbhost;database=$dbname;uid=$db +user;pwd=$dbpass;'; my $dbh = DBI->connect("dbi:ODBC:$DSN") or die $DBI::errstr\n";

From the DBD::ODBC documentation (where it "says Connect without DSN The ability to connect without a full DSN is introduced in version 0.21.").
I am sure this has been covered before, a Super Search would have been a good idea.
Let me know how you get on.

Martin

Updated: Fixed typo thanks to arunvelusamy

Replies are listed 'Best First'.
Re^2: Trying to connect to a MsSql Database
by arunvelusamy (Monk) on Oct 26, 2005 at 11:17 UTC
    ---my $DSN = 'driver={SQL Server};Server=$dbhost;database=$dbhost;uid= +$db +user;pwd=$dbpass;';
    its 'database=$dbname;' and not 'database=$dbhost;'.