This code tested on Win NT,95,98,2k,2k3,XP with ActiveState Perl 5.8.6use Win32::ODBC; print "Add DSN successful" if add_dsn('TestDSN'); sub add_dsn { my $dsn = shift; my $result = Win32::ODBC::ConfigDSN( ODBC_ADD_DSN, "SQL Server", ## this last is the driver name ( ##options "DSN=$dsn", ## DSN identifier "NETWORK=DBMSSOCN", ## use TCP/IP library "SERVER=test_server", ## server name "DATABASE=test_db", ## database name "DESCRIPTION=My test DSN" ) ); ## end of ConfigDSN call unless ($result) { print STDERR "Couldn't create $dsn because of error: " .Win32::ODBC::Error()."\n"; return undef; } return 1; } #^^ add_dsn
Anima Legato
.oO all things connect through the motion of the mind
In reply to Re: Can I set the DSN for an ODBC connection?
by legato
in thread Can I set the DSN for an ODBC connection?
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |