Ask a Question related to PERL Miscellaneous, Design and Development.
-
Andrew Burton #1
need DBD::ODBC help
I'm trying to get a Linux box, with RedHat 8 and Perl 5.8.0, to connect with an
AS400 machine through ODBC. I'm fairly sure I can get it to connect, because I
don't get an error until I try to use $db->prepare(). I will post the code and
errors below. I get two errors, but I am fairly sure the second error is a
result of the first. My main questions, to anyone who has written a Perl
script/program that connects to an IBM machine, are three-fold:
1. What am I doing wrong?
2. Should I be using DBD::DB2?
3. If so, what kind of drivers do I need to use DBD::DB2?
Thanks for any help, as me and my boss have spent a good bit of time digging
through IBM sites, the Usenet, and the web. Thanks. Here's the bit of code
I'm using to "prototype" a connection:
....and here are the errors I get:Code:#!/usr/bin/perl -w use strict; use DBI; my $db = DBI->connect('dbi:ODBC:AS400', 'myid', 'mypassword') or die $DBI::errstr; my $out = $db->prepare("SELECT * FROM CD02 WHERE CD02_INSTRNO = '4110'"); $out->execute() or die $DBI::errstr; while (my @lala = $out->fetchrow_array()) { foreach my $la (@lala) { print "$la\t"; } print "\n"; } exit;
[errors]
DBD::ODBC::db prepare failed: [unixODBC][IBM][iSeries Access ODBC Driver][DB2
UDB] (SQL-HY000)
[unixODBC][IBM][iSeries Access ODBC Driver][DB2 UDB] (SQL-42S02)(DBD:
st_prepare/SQLPrepare err=-1) at ./odbctest line 8.
Can't call method "execute" on an undefined value at ./odbctest line 9.
[/errors]
Andrew Burton - tuglyraisin at aol dot com
Felecia Station on Harvestgain - [url]http://www.darkbeast.com/[/url]
"I often question my sanity; it has yet to give me a straight answer."
"And if you're bored, it's because... you're boring." - Matt Drudge
Andrew Burton Guest
-
ODBC driver does not show up in driver list in ODBC data source administrator
Installed an ODBC driver on a Windows Server 2003 machine. A key shows up in the registry under HKEY_LOCAL_MACHINE- seperate listing under... -
ODBC Socket doesn't show my list of ODBC DSN's!?!
In the ColdFusion MX 7 Administrator, when I try to create a new datasource of type ?ODBC Socket?, the drop down labled ?ODBC DSN? that is supposed... -
[ODBC] ODBC (win32) X PostgreSQL(Linux)
Hi Fabricio, fbbsantos wrote: I need to know enough that if I sat down at your computer I could find the problem. For example, what... -
#24697 [Fbk->NoF]: odbc can not return accurate result when we handle excel file use odbc
ID: 24697 Updated by: sniper@php.net Reported By: tty3000 at hotmail dot com -Status: Feedback +Status: ... -
#24697 [NEW]: odbc can not return accurate result when we handle excel file use odbc
From: tty3000 at hotmail dot com Operating system: win 2000 PHP version: 4.3.2 PHP Bug Type: ODBC related Bug description: ... -
Andrew Burton #2
need DBD::ODBC help
[cross-posted from comp.lang.perl.misc since this is a DB2 question.]
I'm trying to get a Linux box, with RedHat 8 and Perl 5.8.0, to connect with an
AS400 machine through ODBC. I'm fairly sure I can get it to connect, because I
don't get an error until I try to use $db->prepare(). I will post the code and
errors below. I get two errors, but I am fairly sure the second error is a
result of the first. My main questions, to anyone who has written a Perl
script/program that connects to an IBM machine, are three-fold:
1. What am I doing wrong?
2. Should I be using DBD::DB2?
3. If so, what kind of drivers do I need to use DBD::DB2?
Thanks for any help, as me and my boss have spent a good bit of time digging
through IBM sites, the Usenet, and the web. Thanks. Here's the bit of code
I'm using to "prototype" a connection:
....and here are the errors I get:Code:#!/usr/bin/perl -w use strict; use DBI; my $db = DBI->connect('dbi:ODBC:AS400', 'myid', 'mypassword') or die $DBI::errstr; my $out = $db->prepare("SELECT * FROM CD02 WHERE CD02_INSTRNO = '4110'"); $out->execute() or die $DBI::errstr; while (my @lala = $out->fetchrow_array()) { foreach my $la (@lala) { print "$la\t"; } print "\n"; } exit;
[errors]
DBD::ODBC::db prepare failed: [unixODBC][IBM][iSeries Access ODBC Driver][DB2
UDB] (SQL-HY000)
[unixODBC][IBM][iSeries Access ODBC Driver][DB2 UDB] (SQL-42S02)(DBD:
st_prepare/SQLPrepare err=-1) at ./odbctest line 8.
Can't call method "execute" on an undefined value at ./odbctest line 9.
[/errors]
Andrew Burton - tuglyraisin at aol dot com
Felecia Station on Harvestgain - [url]http://www.darkbeast.com/[/url]
"I often question my sanity; it has yet to give me a straight answer."
"And if you're bored, it's because... you're boring." - Matt Drudge
Andrew Burton Guest
-
Ron Reidy #3
Re: need DBD::ODBC help
see below ...
Andrew Burton wrote:I would. ODBC will most likely not be as fast as the native driver for DB2.> I'm trying to get a Linux box, with RedHat 8 and Perl 5.8.0, to connect with an
> AS400 machine through ODBC. I'm fairly sure I can get it to connect, because I
> don't get an error until I try to use $db->prepare(). I will post the code and
> errors below. I get two errors, but I am fairly sure the second error is a
> result of the first. My main questions, to anyone who has written a Perl
> script/program that connects to an IBM machine, are three-fold:
>
> 1. What am I doing wrong?
>
> 2. Should I be using DBD::DB2?
I would guess you will need to install DB2 on your linux server.>
> 3. If so, what kind of drivers do I need to use DBD::DB2?
>
> Thanks for any help, as me and my boss have spent a good bit of time digging
> through IBM sites, the Usenet, and the web. Thanks. Here's the bit of code
> I'm using to "prototype" a connection:
>
>Code:> #!/usr/bin/perl -w > > use strict; > use DBI; > > my $db = DBI->connect('dbi:ODBC:AS400', 'myid', 'mypassword') or die > $DBI::errstr; > > my $out = $db->prepare("SELECT * FROM CD02 WHERE CD02_INSTRNO = '4110'");Code:Your error message is too vague. Check for success: $db->prepare("...") || die $DBI::errstr;> $out->execute() or die $DBI::errstr; > > while (my @lala = $out->fetchrow_array()) { > foreach my $la (@lala) { > print "$la\t"; > } > > print "\n"; > } > > exit; >What is "SQL-42S02"?>
> ...and here are the errors I get:
>
> [errors]
> DBD::ODBC::db prepare failed: [unixODBC][IBM][iSeries Access ODBC Driver][DB2
> UDB] (SQL-HY000)
> [unixODBC][IBM][iSeries Access ODBC Driver][DB2 UDB] (SQL-42S02)(DBD:
> st_prepare/SQLPrepare err=-1) at ./odbctest line 8.
> Can't call method "execute" on an undefined value at ./odbctest line 9.
> [/errors]
>
>
> Andrew Burton - tuglyraisin at aol dot com
> Felecia Station on Harvestgain - [url]http://www.darkbeast.com/[/url]
> "I often question my sanity; it has yet to give me a straight answer."
> "And if you're bored, it's because... you're boring." - Matt Drudge
--
Ron Reidy
Oracle DBA
Ron Reidy Guest
-
Tim Haynes #4
Re: need DBD::ODBC help
[email]tuglyraisin@aol.comm[/email]cast (Andrew Burton) writes:
[snip]> use strict;
> use DBI;
>
> my $db = DBI->connect('dbi:ODBC:AS400', 'myid', 'mypassword') or die
> $DBI::errstr;
>
> my $out = $db->prepare("SELECT * FROM CD02 WHERE CD02_INSTRNO = '4110'");
> $out->execute() or die $DBI::errstr;Well, the prepare is failing for some strange reason. Can you execute this> ...and here are the errors I get:
>
> [errors]
> DBD::ODBC::db prepare failed: [unixODBC][IBM][iSeries Access ODBC Driver][DB2
> UDB] (SQL-HY000)
> [unixODBC][IBM][iSeries Access ODBC Driver][DB2 UDB] (SQL-42S02)(DBD:
> st_prepare/SQLPrepare err=-1) at ./odbctest line 8.
> Can't call method "execute" on an undefined value at ./odbctest line 9.
> [/errors]
as a simple `do' query, ie
| $rv = $db->do($statement);
?
Also, what about trying to execute the same statement against the same DSN
using either unixODBC's `isql' tool, or iODBC's `iodbctest'? Any errors
there?
~Tim
--
Product Development Consultant
OpenLink Software
Tel: +44 (0) 20 8681 7701
Web: <http://www.openlinksw.com>
Universal Data Access & Data Integration Technology Providers
Tim Haynes Guest
-
Thomas Kratz #5
Re: need DBD::ODBC help
"Andrew Burton" <tuglyraisin@aol.commcast> wrote in
news:20030915124946.03231.00000839@mb-m11.aol.com...connect with an> I'm trying to get a Linux box, with RedHat 8 and Perl 5.8.0, toconnect, because I> AS400 machine through ODBC. I'm fairly sure I can get it topost the code and> don't get an error until I try to use $db->prepare(). I willerror is a> errors below. I get two errors, but I am fairly sure the secondYep.> result of the first.
time digging> My main questions, to anyone who has written a Perl
> script/program that connects to an IBM machine, are three-fold:
>
> 1. What am I doing wrong?
>
> 2. Should I be using DBD::DB2?
>
> 3. If so, what kind of drivers do I need to use DBD::DB2?
>
> Thanks for any help, as me and my boss have spent a good bit ofbit of code> through IBM sites, the Usenet, and the web. Thanks. Here's theor die> I'm using to "prototype" a connection:
>
> [code]
> #!/usr/bin/perl -w
>
> use strict;
> use DBI;
>
> my $db = DBI->connect('dbi:ODBC:AS400', 'myid', 'mypassword')# write a tracefile, perhaps you'll get a better error message.> $DBI::errstr;
# raise the tracelevel for more info (--> perldoc DBI)
$db->trace(3, 'trace.log');
'4110'");> my $out = $db->prepare("SELECT * FROM CD02 WHERE CD02_INSTRNO =$out will be undefined when the prepare fails. You should check> $out->execute() or die $DBI::errstr;
that.
[snipped the rest]
Thomas
Thomas Kratz Guest
-
Philip Nelson #6
Re: need DBD::ODBC help
Andrew,
If you have a DB2 Connect box, then you can use this to connect up to DB2
from a standard DB2 client.
Then you can use DBD::DB2.
Phil
On Mon, 15 Sep 2003 17:03:23 +0000, Andrew Burton wrote:
> [cross-posted from comp.lang.perl.misc since this is a DB2 question.]
>
> I'm trying to get a Linux box, with RedHat 8 and Perl 5.8.0, to connect with an
> AS400 machine through ODBC. I'm fairly sure I can get it to connect, because I
> don't get an error until I try to use $db->prepare(). I will post the code and
> errors below. I get two errors, but I am fairly sure the second error is a
> result of the first. My main questions, to anyone who has written a Perl
> script/program that connects to an IBM machine, are three-fold:
>
> 1. What am I doing wrong?
>
> 2. Should I be using DBD::DB2?
>
> 3. If so, what kind of drivers do I need to use DBD::DB2?
>
> Thanks for any help, as me and my boss have spent a good bit of time digging
> through IBM sites, the Usenet, and the web. Thanks. Here's the bit of code
> I'm using to "prototype" a connection:
>
>>Code:> #!/usr/bin/perl -w > > use strict; > use DBI; > > my $db = DBI->connect('dbi:ODBC:AS400', 'myid', 'mypassword') or die > $DBI::errstr; > > my $out = $db->prepare("SELECT * FROM CD02 WHERE CD02_INSTRNO = '4110'"); > $out->execute() or die $DBI::errstr; > > while (my @lala = $out->fetchrow_array()) { > foreach my $la (@lala) { > print "$la\t"; > } > > print "\n"; > } > > exit; >
> ...and here are the errors I get:
>
> [errors]
> DBD::ODBC::db prepare failed: [unixODBC][IBM][iSeries Access ODBC Driver][DB2
> UDB] (SQL-HY000)
> [unixODBC][IBM][iSeries Access ODBC Driver][DB2 UDB] (SQL-42S02)(DBD:
> st_prepare/SQLPrepare err=-1) at ./odbctest line 8.
> Can't call method "execute" on an undefined value at ./odbctest line 9.
> [/errors]
>
> Andrew Burton - tuglyraisin at aol dot com
> Felecia Station on Harvestgain - [url]http://www.darkbeast.com/[/url]
> "I often question my sanity; it has yet to give me a straight answer."
> "And if you're bored, it's because... you're boring." - Matt DrudgePhilip Nelson Guest



Reply With Quote

