in reply to Re: perl remote oracle database connection
in thread perl remote oracle database connection

I wrote simple perl scripts and they run fine. In my script I get the "premature end of script" error the moment I add this line
my $dbh = DBI->connect('dbi:Oracle:host=host.domain.tld;sid=SID;port=1 +521', 'USER', 'PASS', { RaiseError => 1, AutoCommit => 0 });
Is this some issue with the DBD::Oracle????
This is what I get: -
Server error! The server encountered an internal error and was unable to complete your request. Error message: Premature end of script headers: connect-test.pl
If you think this is a server error, please contact the webmaster. Error 500

I really don't know whats the issue. I tried setting oracle environment variables in the script but no help.
Please help!!!!

Replies are listed 'Best First'.
Re^3: perl remote oracle database connection
by Tobin Cataldo (Monk) on May 25, 2006 at 22:18 UTC
    Are the simple perl scripts CGI or Oracle connection scripts?

    The first thing you should do is run your oracle connect on the command line until you know it is working right (without the cgi)... That way atleast you will get STDERR.

    Question two: do you have the Oracle client installed?
    I seem to remember that Oracle-DBD by itself is no good. You need to also install the Oracle client and get it configured to connect to a remote Oracle Database through such application as SQLPLUS. Then install Oracle-DBD.
    (Its been awhile since I have done anything with this so things might have changed... I just remember Oracle being the complete antithesis of a simple MySQL connection string.)


    You should also check your cgi configuration to make sure you are sending appropriate headers etc from Apache. This could be done by making a simple hello world test using the <h1>Hello World</h1> syntax.


    When both pieces prove to work independently of each other, then you can combine them...
    Tobin

    UPDATE: Oracle Client Lite is also available, but won't include some of the more useful Oracle products like (SQL*Plus). Unless you are very good at configuring TNS listeners etc., I would stick with the whole client package.
Re^3: perl remote oracle database connection
by srdst13 (Pilgrim) on May 26, 2006 at 01:43 UTC
    If you truly want to debug the script as CGI, you will need to access your server error log. That is where the actual errors generated by your script will be located. However, I will reiterate my previous sentiment and that of Tobin that you need to make sure that the CGI "Hello world" script works and that you have a script that successfully connects to and can query the database. Once you have both, then you can begin to combine them.

    Sean