DBD::Oracle uses a TNS connect string to connect to the database. Depending on your Oracle client install the TNS names could be stored in a flat file called tnsnames.ora, on a names server, or in OID (Oracle internet directory) repository. Anyway, define a TNS name which will connect to the database in question and test the connection with SQL*Plus. Once you are able to connect with SQL*Plus, try connecting as below:
$dbh = DBI->connect('dbi:Oracle:'.$TNS, $User, $Pass) || die $!;
PLEASE take this with a grain of salt, as I only use TCP for connections to my databases. I played around with using the bequeath adaptor to connect to one of my test instances, and I added the following entry to the local tnsnames.ora file:
(PROTOCOL = BEQ)
(PROGRAM = oracle)
(ARGV0 = oraclenboprd00)
(ARGS = '(DESCRIPTION=(LOCAL=YES)(ADDRESS=(PROTOCOL=BEQ)))')
(CONNECT_DATA = (SID = nboprd00))
The ORACLE_SID of the database to which I was connecting is "nboprd00". To use this TNS name with the connection code above, set $TNS='beqtst';
One other CYA, I did not test this with DBD::Oracle... I only tested it with SQL*Plus (I do not have DBD::Oracle installed on this test system, and I am not about to play with my install an hour before I leave for holiday. *Grins*)
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.
| & || & |
| < || < |
| > || > |
| [ || [ |
| ] || ] ||