#!/usr/bin/perl use warnings; use strict; use DBI; print "ORACLE_HOME: $ENV{'ORACLE_HOME'}\n"; my $tnsnames = "$ENV{'ORACLE_HOME'}/network/admin/tnsnames.ora"; -e $tnsnames || die "$tnsnames does not exist\n"; -r $tnsnames || die "cannot read $tnsnames\n"; open( TNS, '<', $tnsnames ) || die "could not open $tnsnames for readi +ng"; my $sid = 'development'; my $found_it = 0; while (<TNS>) { if ( /\b$sid\b/ ) { print "found $sid\n"; $found_it++; last; } } die "didn't find $sid\n" unless $found_it; close TNS; print "connecting to $sid\n"; my ($user, $pass) = qw( ... ... ); my $dbh = DBI->connect("dbi:Oracle:$sid",$user,$pass,{ RaiseError => 1 + }) || die "could not connect: $!\n"; print "connected!\n"; print "doing a simple query\n"; my $result = $dbh->selectall_arrayref('select sysdate from dual'); print "sysdate: @{ [ map { @{ $_ } } @$result ] }\n"; $dbh->disconnect;
In reply to Re: (OT) DBD error Ora-12154
by Codon
in thread (OT) DBD error Ora-12154
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |