#! perl use strict; use Win32::ODBC; my $dsn = "mydsn"; # name of the DSN in ODBC manager my $dsnDescription = "testdsn"; my $sqlServer = "mymachine"; # Hostname of the SQL-Server my $database = "mydb"; # Name of Database my $uid = ""; # userId my $password = ""; # password if (Win32::ODBC::ConfigDSN ( ODBC_ADD_DSN, "SQL Server", # or name of ODBC ( "DSN=$dsn", "DESCRIPTION=$dsnDescription", "SERVER=$sqlServer", "DATABASE=$database", "UID=$uid", "PWD=$password", ) ) ){ print ("DSN $dsn sucessfully created\n"); } else { die ("ERROR: couldn't create DSN '$dsn': ".Win32::ODBC::Error()); }