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 esoftmatic.com 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.
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.