emma has asked for the wisdom of the Perl Monks concerning the following question:
The following script runs from the command line, but not from an Internet browser.
_________
# declare libraries use CGI qw(:standard); use DBI; use strict; print "Content-Type: text/html\n\n"; print "<HTML><HEAD><TITLE>Log Script</TITLE></HEAD><BODY>"; # declare variables my $a = 000; my $b = 000; my $c = 'xxxxx'; my $d = 'xxxxxx'; # Connect to datasource my $dbh=DBI->connect('dbi:ODBC:<my dsn name>','xxxxxxx','xxxxxxxx') or print "Couldn't connect to database: " . DBI->errstr . "\n\n"; # Log Info my $log = $dbh->prepare("Insert into <databasename>.fp3 (<fieldname1>, + <fieldname2.) values ('$d', '$c')") or print "Couldn't prepare INSERT statement: ". DBI->errstr. "\n\n +"; $log->execute() or print "Couldn't execute INSERT statement: ". DBI->errstr. "\n\n +"; # Get Journal URL my $geturl = $dbh->prepare("SELECT <fieldname1> FROM <databasename>.fp +3 WHERE <fieldname2> ='$d'") or print "Couldn't prepare SELECT statement: ". DBI->errstr. "\n\n +"; $geturl->execute() or print "Couldn't execute SELECT statement: ". DBI->errstr. "\n\n +"; my @data = $geturl->fetchrow_array(); my $jurl = $data[0]; # Set URL print $jurl . "\n<P>"; my $URL = $jurl; # print $URL; print $URL . "\n<P>"
_________
When I run it from a browser, I get the following error:
Couldn't prepare INSERT statement: [FileMaker][ODBC FileMaker Pro driv +er][FileMaker Pro]Connect failed (SQL-S1000)(DBD: st_prepare/SQLPrepa +re err=-1)
If I delete the INSERT statements, then I get a similar error with the SELECT Statements:
Couldn't prepare SELECT statement: [FileMaker][ODBC FileMaker Pro driv +er][FileMaker Pro]Connect failed (SQL-S1000)(DBD: st_prepare/SQLPrepa +re err=-1)
I have checked the permissions for the scripts and database directories, and everyone is set to at least read the files. In the case of the database directory, everyone is set to read and write.
I have also looked at the environmental variables. I ran a list from the command line and from the browser and compared them. There were a handful that were set through the command line but not through the browser, so I set them like this:
#Set Environmentals $ENV{USERNAME} = "Administrator"; $ENV{APPDATA} = "C:\\Documents and Settings\\Administrator.LRC\\Applic +ation Data"; $ENV{ALLUSERSPROFILE} = "C:\\Documents and Settings\\All Users"; $ENV{TMP} = "C:\\WINNT\\TEMP"; $ENV{USERDNSDOMAIN} = "<our DNS domain>"; $ENV{USERDOMAIN} = "<our domain>"; $ENV{HOMEPATH} = "\\"; $ENV{HOMEDRIVE} = "C:"; $ENV{LOGONSERVER} = "\\\\<SERVER NAME>";
I received the exact same errors.
Does anyone have any idea where my problem is?
Thanks.
-Emma
edited: Mon Jul 15 19:13:00 2002 by jeffa - removed br tags and added code tags
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: DBI Call works from command line but not from browser
by perrin (Chancellor) on Jul 15, 2002 at 20:13 UTC | |
by emma (Initiate) on Jul 16, 2002 at 14:21 UTC | |
by perrin (Chancellor) on Jul 16, 2002 at 14:59 UTC | |
by emma (Initiate) on Jul 16, 2002 at 14:22 UTC | |
Re: DBI Call works from command line but not from browser
by Silicon Cactus (Scribe) on Jul 15, 2002 at 20:25 UTC | |
by emma (Initiate) on Jul 16, 2002 at 14:27 UTC | |
DBI cannot connect from IIS
by LanceDeeply (Chaplain) on May 30, 2003 at 14:45 UTC | |
Re: DBI Call works from command line but not from browser
by screamingeagle (Curate) on Jul 16, 2002 at 17:17 UTC |