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 +.
In reply to Re^2: Oracle 10g Database Connection Trouble
by Photius
in thread Oracle 10g Database Connection Trouble
by Photius
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |