MJohnson90 has asked for the wisdom of the Perl Monks concerning the following question:
Hi,
New to the website, but looking for some advice!
Recently picked up a small project yesterday, which requires me accessing an Oracle database via Perl, i'm using DBI, which as far as i can tell means that i have to specify a SID in the connect string.. However the databases i wish to connect to have multiple nodes and can have different SID's so hard coding them will not be viable.
I've been advised by our database team, that the best way to connect would to use a Service ID? but even a database name would be ok i believe.
Atm my 'connect' code is:
Thanks in advance!my $dbhost = "*HOST*"; my $dbport = "1521"; my $dbsid = "*SID*"; my $dbh = DBI->connect("dbi:Oracle:host=$dbhost;sid=$dbsid;port=$dbpor +t",$username,$password) or die $DBI::errstr; my $sth = $dbh->prepare("SQL STATEMENT");
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Oracle Database Connection
by McA (Priest) on Sep 03, 2014 at 08:29 UTC | |
by MJohnson90 (Initiate) on Sep 03, 2014 at 08:43 UTC | |
by MJohnson90 (Initiate) on Sep 03, 2014 at 08:55 UTC | |
|
Re: Oracle Database Connection
by Tux (Canon) on Sep 03, 2014 at 09:30 UTC |