That sounds like the cgi script is run by a different user than the shell script
If you use the ODBC Manager, try to use a SystemDSN instead of a userDSN, then all users should be able to access it. Or use perl to create the UserDSN for that user:
#! 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());
}
If you need special values you don't know, create the DSN with the ODBC manager and then have a look at your registry:
* System-DSN: HKEY_LOCAL_MACHINE\Software\ODBC
* User-DSN: HKEY_CURRENT_USER\Software\ODBC
there you will find your DSNs with its properties, e.g.
"DATABASE=$database",
"UID=$uid", "PWD=$password",
"Trusted_Connection=Yes",
Best regards,
perl -e "s>>*F>e=>y)\*martinF)stronat)=>print,print v8.8.8.32.11.32"
|