CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: DBI:
Perl and JDBC Oracle RDB, DBI->Prepare() error

 



dfletcher1024
New User

Nov 6, 2009, 10:52 AM

Post #1 of 1 (3959 views)
Perl and JDBC Oracle RDB, DBI->Prepare() error Can't Post

Hello,

I'm trying to figure out how to retrieve data from an Oracle RDB database using JDBC and Perl. I am able to connect to the server, but when I issue the DBI->prepare statement I get a java.io.IOException error in what appears to be caused by an incorrect Convert-BER object. Below are the details.

Installed Software
perl, v5.10.1 built for MSWin32-x86-multi-thread
DBD-JDBC-0.71 (Server Side components is running and I'm able to connect)
Convert-BER-1.32

Program:
------------------------------------------------------------------
#!/perl/site/bin/perl
use DBI;
use strict;

my $hostname="spor10";
my $port=1894;
my %attr = (PrintError => 1, RaiseError => 0, AutoCommit => 1 );

my $url='jdbc:rdbThin://spor10:1895/rtr_shared_db_pcad@transaction=readonly@cli.idleTimeout=60';
$url =~ s/([=;])/uc sprintf("%%%02x",ord($1))/eg;

my $user="jdbc_pcad";
my $password="fscpcad";

my $dsn = "dbi:JDBC:hostname=$hostname:$port;url=$url";

my $dbh = DBI->connect($dsn, $user, $password)
or die "Can't connect to database: $DBI::errstr!\n";

DBI->trace(5);

my $sth = $dbh->prepare("SELECT database_name FROM WIPRTO")
or die "Can't connect to database: $DBI::errstr!\n";

if (!undef($sth)) {
my $sth->execute() or die "Can't execute SQL statement: $DBI::errstr\n";
#
my @row;
while (@row = $sth->fetchrow_array() ) {
print "Row: @row\n";
}
}
$dbh->disconnect();
exit;
----------------------------------------------------------------------------

Error Message:

Please note I have used Data::Dumper to display the BER object contents. From the best I can tell, I need to define a Convert::BER type to match "[APPLICATION 15 constructed]", but I do not know how to do that.

C:\Data\test>jdbc_dbi.pl
$VAR1 = bless( [
'kx♦Ujdbc:rdbThin://spor10:1895/rtr_shared_db_pcad@transaction=readonly@cli.idleTimeout=60♦ jdbc_pcad♦fscpcad♦
ISO8859_1{ ',
0,
[]
], 'DBD::JDBC::BER' );

DBD::JDBC::BER=ARRAY(0x1c81ff4)43 6F 6E 76 65 72 74 3A 3A 42 45 52 __ __ __ __ Convert::BER
BER Tag: 7571295
$VAR1 = bless( [
'v☼♦
AutoCommit♦☺1',
0,
[]
], 'DBD::JDBC::BER' );

DBD::JDBC::BER=ARRAY(0x1c81ff4)43 6F 6E 76 65 72 74 3A 3A 42 45 52 __ __ __ __ Convert::BER
BER Tag: 8292191
DBI 1.609-ithread default trace level set to 0x0/5 (pid 4372) at jdbc_dbi.pl line 21
-> prepare for DBD::JDBC::db (DBI::db=HASH(0x1a4967c)~0x1c4c114 'SELECT database_name FROM WIPRTO') thr#223d84
1 -> trace for DBD::JDBC::db (DBI::db=HASH(0x1c4c114)~INNER) thr#223d84
1 <- trace= ( 5 ) [1 items] at C:/Perl/site/lib/DBD/JDBC.pm line 427 via at C:\Data\test\jdbc_dbi.pl line 23
1 <> FETCH= [ '' 0 ARRAY(0x1c82b44) ] ('jdbc_ber' from cache) at C:/Perl/site/lib/DBD/JDBC.pm line 439 via at C:\Data\test\jdbc_d
bi.pl line 23
1 <> FETCH= ( IO::Socket::INET=GLOB(0x1c820e4) ) [1 items] ('jdbc_socket' from cache) at C:/Perl/site/lib/DBD/JDBC.pm line 442 via
at C:\Data\test\jdbc_dbi.pl line 23
1 <> FETCH= ( [ '' 0 ARRAY(0x1c82b44) ] ) [1 items] ('jdbc_ber' from cache) at C:/Perl/site/lib/DBD/JDBC.pm line 442 via at C:\Data\test\jdbc_dbi.pl line 23
1 -> trace for DBD::JDBC::db (DBI::db=HASH(0x1c4c114)~INNER) thr#223d84
1 <- trace= 5 at C:/Perl/site/lib/DBD/JDBC.pm line 106
Encoding [PREPARE_REQ | ARRAY(0x1c82a44)]
Sending request to server
jdbc:prepare:jdbc_ber: DBD::JDBC::BER=ARRAY(0x1c81ff4)$VAR1 = bless( [
'o$&#9830; SELECT database_name FROM WIPRTO&#9827; ',
0,
[]
], 'DBD::JDBC::BER' );

DBD::JDBC::BER=ARRAY(0x1c81ff4)43 6F 6E 76 65 72 74 3A 3A 42 45 52 __ __ __ __ Convert::BER
Listening for response
Received response from server
BER Tag: 7505791
1-HERE
Error: java.io.IOException: Unrecognized BER object identifier: [APPLICATION 15 constructed]
1 -> set_err in DBD::_::common for DBD::JDBC::db (DBI::db=HASH(0x1c4c114)~INNER '8' 'java.io.IOException: Unrecognized BER object
identifier: [APPLICATION 15 constructed]' 'IJDBC' (magic-sg:x) undef) thr#223d84
!! ERROR: '8' 'java.io.IOException: Unrecognized BER object identifier: [APPLICATION 15 constructed]' (err#1)
1 <- set_err= undef at C:/Perl/site/lib/DBD/JDBC.pm line 158
!! ERROR: '8' 'java.io.IOException: Unrecognized BER object identifier: [APPLICATION 15 constructed]' (err#1)
<- prepare= undef at C:\Data\test\jdbc_dbi.pl line 23
DBD::JDBC::db prepare failed: java.io.IOException: Unrecognized BER object identifier: [APPLICATION 15 constructed] at C:\Data\test\
jdbc_dbi.pl line 23.
-> $DBI::errstr (&) FETCH from lasth=HASH
>> DBD::JDBC::db::errstr
<- $DBI::errstr= 'java.io.IOException: Unrecognized BER object identifier: [APPLICATION 15 constructed]'
Can't connect to database: java.io.IOException: Unrecognized BER object identifier: [APPLICATION 15 constructed]!
-- DBI::END ($@: , $!: )
-> disconnect_all for DBD::JDBC::dr (DBI::dr=HASH(0x1c64d34)~0x1c64cb4) thr#223d84
1 <> FETCH= ( [ DBI::db=HASH(0x1a4967c) ] ) [1 items] ('jdbc_connections' from cache) at C:/Perl/site/lib/DBD/JDBC.pm line 374 via at C:\Data\test\jdbc_dbi.pl line 23
Found 1 connections to close
ERROR: '8' 'java.io.IOException: Unrecognized BER object identifier: [APPLICATION 15 constructed]' (err#1)
<> FETCH= 'hostname=spor10:1894;url=jdbc:rdbThin://spor10:1895/rtr_shared_db_pcad@transaction%3Dreadonly@cli.idleTimeout%3D60' (
'Name' from cache) at C:/Perl/site/lib/DBD/JDBC.pm line 381 via at C:\Data\test\jdbc_dbi.pl line 23
Disconnecting hostname=spor10:1894;url=jdbc:rdbThin://spor10:1895/rtr_shared_db_pcad@transaction%3Dreadonly@cli.idleTimeout%3D60
!! ERROR: '8' CLEARED by call to disconnect method
-> disconnect for DBD::JDBC::db (DBI::db=HASH(0x1a4967c)~0x1c4c114) thr#223d84
1 -> trace for DBD::JDBC::db (DBI::db=HASH(0x1c4c114)~INNER) thr#223d84
1 <- trace= ( 5 ) [1 items] at C:/Perl/site/lib/DBD/JDBC.pm line 526 via at C:\Data\test\jdbc_dbi.pl line 23
1 -> FETCH for DBD::JDBC::db (DBI::db=HASH(0x1c4c114)~INNER 'Active') thr#223d84
.. FETCH DBI::db=HASH(0x1c4c114) 'Active' = 1
1 <- FETCH= 1 at C:/Perl/site/lib/DBD/JDBC.pm line 529 via at C:\Data\test\jdbc_dbi.pl line 23
1 -> STORE for DBD::JDBC::db (DBI::db=HASH(0x1c4c114)~INNER 'Active' 0) thr#223d84
STORE DBI::db=HASH(0x1c4c114) 'Active' => 0
1 <- STORE= 1 at C:/Perl/site/lib/DBD/JDBC.pm line 531 via at C:\Data\test\jdbc_dbi.pl line 23
1 <> FETCH= ( IO::Socket::INET=GLOB(0x1c820e4) ) [1 items] ('jdbc_socket' from cache) at C:/Perl/site/lib/DBD/JDBC.pm line 533 via at C:\Data\test\jdbc_dbi.pl line 23
1 <> FETCH= ( [ '' 0 ARRAY(0x1c82c04) ] ) [1 items] ('jdbc_ber' from cache) at C:/Perl/site/lib/DBD/JDBC.pm line 533 via at C:\Data\test\jdbc_dbi.pl line 23
1 -> trace for DBD::JDBC::db (DBI::db=HASH(0x1c4c114)~INNER) thr#223d84
1 <- trace= 5 at C:/Perl/site/lib/DBD/JDBC.pm line 106 via at C:\Data\test\jdbc_dbi.pl line 23
Encoding [DISCONNECT_REQ | 0]
Sending request to server
$VAR1 = bless( [
'L ',
0,
[]
], 'DBD::JDBC::BER' );

DBD::JDBC::BER=ARRAY(0x1c81ff4)43 6F 6E 76 65 72 74 3A 3A 42 45 52 __ __ __ __ Convert::BER
Listening for response
1 -> set_err for DBD::JDBC::db (DBI::db=HASH(0x1c4c114)~INNER 101 'I/O Error Unknown error ' 'IJDBC') thr#223d84
!! ERROR: 101 'I/O Error Unknown error ' (err#2)
1 <- set_err= ( undef ) [1 items] at C:/Perl/site/lib/DBD/JDBC.pm line 132 via at C:\Data\test\jdbc_dbi.pl line 23
ERROR: 101 'I/O Error Unknown error ' (err#2)
1 <> FETCH= IO::Socket::INET=GLOB(0x1c820e4) ('jdbc_socket' from cache) at C:/Perl/site/lib/DBD/JDBC.pm line 539 via at C:\Data\test\jdbc_dbi.pl line 23
!! ERROR: 101 'I/O Error Unknown error ' (err#2)
<- disconnect= undef at C:/Perl/site/lib/DBD/JDBC.pm line 383 via at C:\Data\test\jdbc_dbi.pl line 23
1 -> errstr in DBD::_::common for DBD::JDBC::dr (DBI::dr=HASH(0x1c64cb4)~INNER) thr#223d84
1 <- errstr= undef at C:/Perl/site/lib/DBD/JDBC.pm line 383 via at C:\Data\test\jdbc_dbi.pl line 23
Failed to disconnect hostname=spor10:1894;url=jdbc:rdbThin://spor10:1895/rtr_shared_db_pcad@transaction%3Dreadonly@cli.idleTimeout%3D60:
<- disconnect_all= undef at C:/Perl/site/lib/DBI.pm line 731 via at C:\Data\test\jdbc_dbi.pl line 23
<> DESTROY(DBI::db=HASH(0x1a4967c)) ignored for outer handle (inner DBI::db=HASH(0x1c4c114) has ref cnt 1)
-> DESTROY for DBD::JDBC::db (DBI::db=HASH(0x1c4c114)~INNER) thr#223d84
-> FETCH for DBD::JDBC::db (DBI::db=HASH(0x1c4c114)~INNER 'Active') thr#223d84
.. FETCH DBI::db=HASH(0x1c4c114) 'Active' = ''
ERROR: 101 'I/O Error Unknown error ' (err#2)
<- FETCH= '' at C:/Perl/site/lib/DBD/JDBC.pm line 740 via at C:\Data\test\jdbc_dbi.pl line 23
ERROR: 101 'I/O Error Unknown error ' (err#2)
<- DESTROY= undef at C:/Perl/site/lib/DBI.pm line 731 via at C:\Data\test\jdbc_dbi.pl line 23
dbih_clearcom 0x1c4c114 (com 0x1c6c224, type 2) done.

! -> DESTROY in DBD::_::common for DBD::JDBC::dr (DBI::dr=HASH(0x1c64cb4)~INNER) thr#223d84
ERROR: 101 'I/O Error Unknown error ' (err#0)
! <- DESTROY= undef during global destruction
dbih_clearcom 0x1c64d34 (com 0x1975db4, type 1) done.

! <> DESTROY for DBI::dr=HASH(0x1c64d34) ignored (inner handle gone)

C:\Data\test>

Code



      
    

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives