General information
Forum:
Microsoft SQL Server
Title:
First perl/ODBC connection
I am trying to figure out how to connect to MSSQL server 7.0 database using perl/odbc thus far I have set up odbc connection that tests successfully but when connecting via perl script i get error message.
The Code used:
#!/perl/bin/perl
&print_header;
&connect_db;
sub print_header{
print "Content-type: text/html\n\n";
}
sub connect_db{
$DSN="GameServer";
use Win32::ODBC;
if (!($db=new Win32::ODBC($DSN ))) {
print "
Error connecting to $DSN\n";
print "Error: " . Win32::ODBC::Error() . "\n";
}
else {
print "Connection Successful";
}
}
The ERROR Msg:
Error connecting to GameServer Error: [18452] [] "[Microsoft][ODBC SQL Server Driver][SQL Server]Login failed for user '(null)'. Reason: Not associated with a trusted SQL Server connection."
How do i use the 'sa' username and pass along in scripts to allow access to the database?
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only