Is it possible to do a connect to a database when there is no entry in the local machines TNSNAMES.ORA file? perl, v5.6.1 built for sun4-solaris $DBI::VERSION = "1.20"; $DBD::Oracle::VERSION = '1.12'; I've tried the following, but to no avail.
... my $conn = "dbi:Oracle:HOST=$host;SID=$sid;port=1521"; my $db_h = DBI->connect ( $conn, $user, $pwd, { AutoCommit => 0, # 0 = false RaiseError => 0, PrintError => 0, ChopBlanks => 1 # CHAR chopped } ) || BEGIN { print color 'red on_black'; warn "\n" . "x" x 70 . "\n" . "\t--> Connecting to " . uc ( $sid ) . " as " . uc ( $user ) . " <--\n\n" + . $DBI::errstr . "\n" . "x" x 70 . "\n"; print color 'reset'; print "\n"; return undef; }; ...
I get the following errors
********************************************************************** +* Fatal NI connect error 12541, connecting to: (DESCRIPTION=(ADDRESS=(HOST=machineA.com)(PROTOCOL=tcp)(PORT=1521))(CO +NNECT­_DATA=(SID=aaa)(CID=(PROGRAM=t2.pl@bbb) (HOST=aaa)(USER=uuuuu)))) ********************************************************************** +* Fatal NI connect error 12535, connecting to: (DESCRIPTION=(ADDRESS=(HOST=machineA.com)(PROTOCOL=tcp)(PORT=1521))(CO +NNECT­_DATA=(SID=aaa)(CID=(PROGRAM=t2.pl@bbb) (HOST=aaa)(USER=uuuuu)))) ********************************************************************** +* Fatal NI connect error 12505, connecting to: (DESCRIPTION=(ADDRESS=(HOST=machineA.com)(PROTOCOL=tcp)(PORT=1521))(CO +NNECT­_DATA=(SID=aaa)(CID=(PROGRAM=t2.pl@bbb) (HOST=aaa)(USER=uuuuu))))

Edited (davorg): Replace <pre> tags with <code>


In reply to DBI connect without an entry in TNSNAMES.ORA by ericdp

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • 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:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, 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, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.