Hello all,
I am having some problems connecting to an Oracle DB via the DBI mod. I have Both the DBI and DBD::Oracle installed ok as I checked with the ppm "query" command.
I have the Oracle client set up ok as I can connect through Oracle net manager to my DB no problem.
Here is my code. It is right out of the CPAN mod description:
It cannot even connect. Here is my output:
I even tried to create and ENVAR DBI_DSN. No go.
Any help is appriciated.
Nick
If at first you don't succeed, don't try skydiving.
I am having some problems connecting to an Oracle DB via the DBI mod. I have Both the DBI and DBD::Oracle installed ok as I checked with the ppm "query" command.
I have the Oracle client set up ok as I can connect through Oracle net manager to my DB no problem.
Here is my code. It is right out of the CPAN mod description:
Code:
my $orauser = "xxxx";
my $orapass = "xxxx";
use DBI;
#use DBD::Oracle;
use strict;
use warnings;
my $name;
my $phone;
my $data_source = 'dbi::Oracle:binvdp01';
my $dbh = DBI->connect($data_source, $orauser, $orapass)
or die "Can't connect to $data_source: $DBI::errstr";
my $sth = $dbh->prepare( q{
select T1.SVALUE, T2.SVALUE from twtpropvalues T1, twtpropvalues T2 where
T1.PROPID=(select ID from twtproperties where WID='00000000000000000000000000000001')
and T2.PROPID=(select ID from twtproperties where WID='72B1577C795AB24888F4462B18D8F42D')
and T1.INSID=T2.INSID;
}) or die "Can't prepare statement: $DBI::errstr";
my $rc = $sth->execute
or die "Can't execute statement: $DBI::errstr";
print "Query will return $sth->{NUM_OF_FIELDS} fields.\n\n";
print "Field names: @{ $sth->{NAME} }\n";
while (($name, $phone) = $sth->fetchrow_array) {
print "$name: $phone\n";
}
# check for problems which may have terminated the fetch early
die $sth->errstr if $sth->err;
$dbh->disconnect;
It cannot even connect. Here is my output:
Code:
D:\Stage>db_conn_test.pl
Can't connect to data source Oracle:binvdp01, no database driver specified and DBI_DSN env var not set at D:\Stage\db_conn_test.pl line 40
I even tried to create and ENVAR DBI_DSN. No go.
Any help is appriciated.
Nick
If at first you don't succeed, don't try skydiving.