Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change

Same Script different OS

by Jonathan (Curate)
on Nov 02, 2004 at 09:50 UTC ( #404542=perlquestion: print w/ replies, xml ) Need Help??
Jonathan has asked for the wisdom of the Perl Monks concerning the following question:

This script runs fine on Solaris...
#!/usr/local/bin/perl use warnings; use strict; use DBI; my $dbh = DBI->connect("DBI:Oracle:"."a_database", "a_user", "a_password", {AutoCommit => 1, PrintError => 0, RaiseError => 0 }) or die "Couldn't connect to a_database: " . $DBI::errstr; my $res = $dbh->selectall_arrayref("select 1 from dualXXX"); unless ($DBI::err == 0) { print "SQL Failed: ${DBI::err}\n${DBI::errstr}\n"; } else { print "Successful\n"; } $dbh->disconnect();
and as expected returns
SQL Failed: 942 ORA-00942: table or view does not exist (DBD ERROR: OCIStmtExecute/Des +cribe)
However, running the same script on the WinXP cmd shell the script bombs with one of those annoying Windows popups about telling microsoft the problem.

How can I trap my SQL failure in WinXP? I've tried using eval but that makes no difference.

Update 1

I downloaded the DBI and the Oracle DBD from here following their instructions and used their DBI version instead of the ActiveState one but still no joy.

Update 2

Finally got it working.

As above the ActiveState DBI package is not compatible with the Oracle DBD build but by stumbling around in my usual chaotic manner I chanced upon the combo of DBI and DBD versions that work.

Apologies for wasting everyones time.

Replies are listed 'Best First'.
Re: Same Script different OS
by tachyon (Chancellor) on Nov 02, 2004 at 10:08 UTC

    The *This program has encountered an unexpected error an must be shut down* is really just a bit of user interface fluff wrapped over an unrecoverable core dump/BSOD.

    Perl is crashing or actually DBI/DBD::Oracle. Make sure you have the latest DBI and a DBD::Oracle that is built for your server. There are several vaguely incompatible Oracle libraries that the DBD could have been buillt against.



Re: Same Script different OS
by BrowserUk (Pope) on Nov 02, 2004 at 10:03 UTC

    Right click "My Computer"->Properties->Advanced->Error Reporting->Disable Error Reporting(->But notify me when critical errors occur).

    May get you some way to what you want.

    Examine what is said, not who speaks.
    "Efficiency is intelligent laziness." -David Dunham
    "Think for yourself!" - Abigail
    "Memory, processor, disk in that order on the hardware side. Algorithm, algorithm, algorithm on the code side." - tachyon
Re: Same Script different OS
by rinceWind (Monsignor) on Nov 02, 2004 at 10:07 UTC
    Have you tried running the script under perl5db, single stepping it to see where it bombs? I expect that this is in the connect, but I could be wrong.

    What version of DBI and DBD::Oracle are you running, and where did they come from?

    If you Have Visual Studio 6 and MVC6, you should be able to get a debug option on the crash window, which launches the Visual Studio IDE, enabling you to see where it has failed.

    I'm Not Just Another Perl Hacker

Re: Same Script different OS
by Jonathan (Curate) on Nov 02, 2004 at 10:28 UTC
    Thanks for the Feedback.

    The script will connect to the database and works fine if the SQL is successful. It just won't trap errors without crashing. This makes it a useless environment for me :-(.

    Unfortunately changing windows settings doesn't make any difference.

    I downloaded a binary DBD::Oracle winxp driver so that could be the problem but I don't have any alternative. I guess its natures way of telling me to stick to Unix.

      You have a serious problem, one the DBI developers should know about. I'd advise you to subscribe to the dbi-users mailing list, and describe the problem there. (I think Tim Bunce is responsible for DBD::Oracle, so you'll probably get a reply from him.)

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://404542]
Approved by Corion
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (4)
As of 2016-08-28 22:01 GMT
Find Nodes?
    Voting Booth?
    The best thing I ever won in a lottery was:

    Results (396 votes). Check out past polls.