CanisAnubis has asked for the wisdom of the Perl Monks concerning the following question:

I'm attempting to use DBI and DBD::Oracle to connect to an oracle rac instance, however, I don't have access to the SID of the database. Our other applications use the SERVICE_NAME to connect to the database required. Is this possible via the perl DBD::Oracle api, or am I out of luck?
  • Comment on Difficulty connecting to Oracle Rac instance with DBD::Oracle

Replies are listed 'Best First'.
Re: Difficulty connecting to Oracle Rac instance with DBD::Oracle
by Anonymous Monk on Feb 01, 2011 at 02:32 UTC
Re: Difficulty connecting to Oracle Rac instance with DBD::Oracle
by Mr. Muskrat (Canon) on Feb 01, 2011 at 16:50 UTC

    Have you read the docs for DBD::Oracle? It shows how to use the service name to connect. Although, to be fair, it calls it the SQL*Net 2.x connection descriptor. That's what a service name is really; a connection descriptor. The following code is totally untested. (Be sure you have your usual Oracle config in place environment variables set, yadda yadda yadda...)

    use DBI; my $db_user = 'Scott'; my $db_pass = 'Tiger'; my $service_name = 'foo'; my $dbh = DBI->connect("dbi:Oracle:$service_name", $db_user, $db_pass) +;