in reply to Re: Oracle 10g Database Connection Trouble
in thread Oracle 10g Database Connection Trouble
With other applications that connect to our Oracle databases, we are using the Oracle tnsnames.ora file which contains the various connect string stanzas. I simply copied the same connect string from the TNS file that we normally use. So excertps from my Perl code look like this:Can't connect to data source '(LOAD_BALANCE=on)' because I can't work +out what driver to use (it doesn't seem to contain a 'dbi:driver:' pr +efix and the DBI_DRIVER env var is not se t) at H:\Projects\NLSExport\ExportNLSched.pl line 65
This connect string is a little more involved because of load balancing.use strict; use lib 'c:/Perl/lib/DBI'; use DBI; my $dbh; my $dbConnectString = '(LOAD_BALANCE=on)'|| '(ADDRESS=(PROTOCOL=TCP)(HOST=myhost1)(PORT=1521 +))'|| '(ADDRESS=(PROTOCOL=TCP)(HOST=myhost2)(PORT=1521 +))'|| '(CONNECT_DATA=(SERVICE_NAME=pcipJDBC.oracle.com +))'; my $dbUser = 'myUsername'; my $dbPwd = 'myPassword'; + unless ($dbh = DBI->connect($dbConnectString, $dbUser, $dbPwd, {RaiseE +rror => 0, AutoCommit => 0 })) { # Handle for PROD database connectio +n die "Unable to connect to PCI Oracle as user $dbUser: $DBI::errstr: +$!"; } $dbh->{RaiseError} = 1; + # So we don't have to check every DBI call we set RaiseError +.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Oracle 10g Database Connection Trouble
by massa (Hermit) on Aug 25, 2008 at 17:19 UTC | |
|
Re^3: Oracle 10g Database Connection Trouble
by moritz (Cardinal) on Aug 25, 2008 at 17:10 UTC | |
|
Re^3: Oracle 10g Database Connection Trouble
by Photius (Sexton) on Aug 25, 2008 at 18:54 UTC | |
|
Re^3: Oracle 10g Database Connection Trouble
by toolic (Bishop) on Aug 25, 2008 at 17:09 UTC | |
|
Re^3: Oracle 10g Database Connection Trouble
by Anonymous Monk on Aug 25, 2008 at 17:22 UTC |