You don't tell us what webserver you are using, but from the problem you have, I guess it is IIS. Under IIS, all CGI scripts run as the SYSTEM user or the IIS user, however it's called. Neither have privileges to access network shares, and it would be a bad security decision to give them those privileges.
I can only recommend you to get a real database instead of trying to connect via SMB shares. You could look at DBD::Proxy and have it running on the other machine and connect from your script on the server to the proxy, or you could run DBD::Proxy on your webserver as a different user.
I think that you configure the user Apache uses either via the httpd.conf or, if Apache runs as a service, in the service manager.
SMB shares is another word for "network shares". SMB is the protocol that Windows uses.
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"
perlmonks.org content © perlmonks.org and Corion, roscomputing, strat
prlmnks.org © 2006 edmund von der burg (eccles & toad)
v 0.03