I use the following code: # # Database/ODBC declarations and options # $db_user = "iusr_ncdb"; $db_pass = "xxxxxxxx"; $dsn_name = 'dbi:ODBC:NCDB';
$dbh = DBI->connect($dsn_name, $db_user, $db_pass, { PrintError => 0, AutoCommit => 1 }); if(!defined($dbh)) { print "Error connecting to DSN '$dsn_name'\n"; print "Error was:\n"; print "$DBI::errstr\n"; return 0; } The code snippet assumes there is a DSN already created in Windows that uses the SQL Server driver, and that it has the right server name and authentication method set. Ben.... -- [EMAIL PROTECTED] ----- Original Message ----- From: John.F.Kennedy Sent: 8/21/2002 10:54:01 AM Cc: [EMAIL PROTECTED];[EMAIL PROTECTED];[EMAIL PROTECTED];[EMAIL PROTECTED];[EMAIL PROTECTED] Subject: problem connecting to SQL server 2000 > I am having a problem connecting to SQL server 2000 using DBI. Below are my > code and the error message I get could some point me in the right direction. > > sub Connect_To_DataBase > { > my ($continue,$dsn); > $continue = $TRUE; > Create_Log("null","Attempting to connect to My Database"); > > $dsn = "Driver={SQL Server};Server =MyServerName;Database= > MyDatabaseName "; > > $DBH = DBI->connect("dbi:ODBC:$dsn","username", "password", > { > RaiseError => 0, > PrintError => 0, > AutoCommit => 0 > } ) or > Create_Error_Log($DBH::errstr,1,"DFD1_A",1033,"DFD1"),$continue = $FALSE; > > return $continue; > } > > Error : [Microsoft][ODBC Driver Manager] Invalid string or buf > > Thanks > John Kennedy > > _______________________________________________ > Perl-Win32-Admin mailing list > [EMAIL PROTECTED] > To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs > _______________________________________________ Perl-Win32-Admin mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs