(guess i don't have to mention i'm a DBI newbie, so thanks for your
patience)
this is a test script (btw, 'make test' worked fine when installing
DBD::Oracle):
#!/usr/bin/perl -w
use strict;
use DBI;
DBI->trace(4, '/tmp/trace.trc');
my $dbs = DBI->connect ('DBI:Oracle:ora901','system','manager',)|| die "DB
conne
ct not made: $DBI::errstr";
$dbs->disconnect();

the trace log doesn't reveal something to me:
    DBI 1.32-nothread dispatch trace level set to 4
    -> DBI->connect(DBI:Oracle:ora901, system, ****)
    -> DBI->install_driver(Oracle) for linux perl=5.006 pid=2633 ruid=119
euid=1
19
       install_driver: DBD::Oracle version 1.12 loaded from
/usr/lib/perl5/site_
perl/5.6.0/i386-linux/DBD/Oracle.pm
    New DBI::dr (for DBD::Oracle::dr, parent=, id=)
    dbih_setup_handle(DBI::dr=HASH(0x8186828)=>DBI::dr=HASH(0x81ecc48),
DBD::Ora
cle::dr, 0, Null!)
    dbih_make_com(Null!, DBD::Oracle::dr, 88) thr#(nil)
    <- install_driver= DBI::dr=HASH(0x8186828)
    -> connect for DBD::Oracle::dr (DBI::dr=HASH(0x8186828)~0x81ecc48
'ora901' '
system' **** HASH(0x81609c8))
    New DBI::db (for DBD::Oracle::db, parent=DBI::dr=HASH(0x81ecc48), id=)
    dbih_setup_handle(DBI::db=HASH(0x81ecc0c)=>DBI::db=HASH(0x8159020),
DBD::Ora
cle::db, 81840a8, Null!)
    dbih_make_com(DBI::dr=HASH(0x81ecc48), DBD::Oracle::db, 116) thr#(nil)
    OCIErrorGet after OCIServerAttach (er1:ok): -1, 12154: ORA-12154:
TNS:could
not resolve service name

    !! ERROR: 12154 'ORA-12154: TNS:could not resolve service name (DBD
ERROR: O
CIServerAttach)'
    <- connect= undef at DBI.pm line 513 via ./db_connect.pl line 5
    -> errstr in DBD::_::common for DBD::Oracle::dr
(DBI::dr=HASH(0x8186828)~0x8
1ecc48)
    <- errstr= 'ORA-12154: TNS:could not resolve service name (DBD ERROR:
OCISer
verAttach)' at DBI.pm line 515 via ./db_connect.pl line 5
       DBI connect('ora901','system',...) failed: ORA-12154: TNS:could not
resol
ve service name (DBD ERROR: OCIServerAttach)
    -> $DBI::errstr (&) FETCH from lasth=HASH
    >> DBD::Oracle::dr::errstr
    <- $DBI::errstr= 'ORA-12154: TNS:could not resolve service name (DBD
ERROR:
OCIServerAttach)'
    <> DESTROY ignored for outer handle DBI::db=HASH(0x81ecc0c) (inner
DBI::db=H
ASH(0x8159020))
    -> DESTROY for DBD::Oracle::db (DBI::db=HASH(0x8159020)~INNER)
         DESTROY for DBI::db=HASH(0x8159020) ignored - handle not
initialised
    <- DESTROY= undef
    dbih_clearcom 0x81ecc0c (com 0x8196290, type 2) done.

    -- DBI::END
    -> disconnect_all for DBD::Oracle::dr
(DBI::dr=HASH(0x8186828)~0x81ecc48)
    <- disconnect_all= '' at DBI.pm line 575 via ./db_connect.pl line 0
    dbih_clearcom 0x8186828 (com 0x81088a8, type 1) done.

    <> DESTROY for DBI::dr=HASH(0x8186828) ignored (inner handle gone)

-----Original Message-----
From: Michael A Chase [mailto:[EMAIL PROTECTED]]
Sent: Sunday, January 12, 2003 5:32 PM
To: '[EMAIL PROTECTED]'; Moshe Rivel
Subject: Re: can't connect to oracle


On Sun, 12 Jan 2003 17:19:09 +0200 Moshe Rivel <[EMAIL PROTECTED]> wrote:

> yes i can
> 
> -----Original Message-----
> From: Michael A Chase [mailto:[EMAIL PROTECTED]]
> Sent: Sunday, January 12, 2003 5:25 PM
> To: '[EMAIL PROTECTED]'; Moshe Rivel
> Subject: Re: can't connect to oracle
> 
> 
> On Sun, 12 Jan 2003 16:49:40 +0200 Moshe Rivel <[EMAIL PROTECTED]> wrote:
> 
> > oracle 9.0.1
> > linux RH 7.1
> > DBI connect('ora901','system',...) failed: ORA-12154: TNS:could not
> resolve
> > service name (DBD ERROR: OCIServerAttach) at ./db_connect.pl line 4
> > DB connect not made: ORA-12154: TNS:could not resolve service name (DBD
> > ERROR: OCIServerAttach) at ./db_connect.pl line 4.
> 
> That sort of error usually indicates a problem in SQL*Net, most often
> in tnsnames.ora.  Can you connect using SQL*Plus in the same host with
> the exact same instance and userid?

Then post a snippet that demonstrates the problem and try running it
with tracing set to level 4 just before the connect attempt.

Look at `perldoc DBI` and look for trace and debugging to see how to
use trace().

-- 
Mac :})
** I normally forward private questions to the appropriate mail list. **
Ask Smarter: http://www.tuxedo.org/~esr/faqs/smart-questions.html
Give a hobbit a fish and he eats fish for a day.
Give a hobbit a ring and he eats fish for an age.

Reply via email to