I am running IIS with ActiveState Perl on a WIN32 machine. The DBD I am using is ODBC to connect to a FileMaker Pro database.

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


In reply to DBI Call works from command line but not from browser by emma

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.