I *don't* have experience with this on Windows, but I assume
you can still use "sqlplus" - can you connect to the database
using sqlplus? If you can connect to the database using sqlplus
then that proves that the Oracle networking files are set up
correctly - if not, then attend to that(setting up Oracle
networking files) first.
Your connect statement:
$dbh = DBI->connect( 'DB1',$user, $password, 'Oracle'
) || die print "Can't connect : $DBI::errstr";
doesn't look correct to me - read the perldocs for the DBI
module and the DBD::Oracle module to figure out the correct
way to connect to Oracle. On Linux, I do "perldoc DBI" and
"perldoc DBD::Oracle", but not sure how to view the perldocs
on Windows.
HTH.
--
Hardy Merrill
Mission Critical Linux, Inc.
http://www.missioncriticallinux.com
David Kirol [[EMAIL PROTECTED]] wrote:
> this is a cut and paste of your line below:
> $dbh = DBI->connect( 'DB1',$user, $password, 'Oracle'
> -Not the whole line. IS ^^^ this correct? or did you mean --'DBI:Oracle',
> $user, $password
> HTH
> "A garod" <[EMAIL PROTECTED]> wrote in message
> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > Has anyone experienced problems getting a previously
> > happy Perl DBI, DBD-oracle drive refuse to connect to
> > the database.
> >
> > I`ve added various lines to tell report back the
> > errors but they aren`t giving me enough clues.
> >
> > One that does crop up is
> >
> > DBI->connect failed: ORA-12203: TNS:unable to connect
> > to destination (DBD ERROR: OCIServerAttach)
> >
> > I`m using Activeperl 5.005 on a Windows NT 4.0 server
> > with IIS 4 against an Oracle 8.05 database. Not ideal
> > I`m sure.
> >
> > Script and error traces are below.
> >
> > Many thanks Andrew
> >
> > #!/usr/bin/perl -w
> > # test cgi app
> > #
> > use CGI::Carp;
> > use CGI;
> > use DBI;
> > use CGI qw(:standard);
> > use POSIX qw(strftime);
> >
> > $q = new CGI;
> > $user = "user";
> > $password = "user";
> >
> > # This sets up the HTML header and table
> >
> > print "Content-Type: text/html\n";
> > print "Pragma: no-cache\n\n";
> > print "<HTML>\n<HEAD><CENTER>\n\n";
> > print "<H2>\ntest</H2>\n</HEAD>\n";
> > print "<BODY>\n<CENTER>";
> >
> > $trace_level = 9;
> > $trace_file = "trace.txt";
> >
> > DBI->trace($trace_level, $trace_file);
> >
> > @ary = DBI->available_drivers;
> >
> > print @ary;
> > print "<p>";
> > print "<P>Should be data sources below this linez<p>";
> > @qary = DBI->data_sources('Oracle');
> > print @qary;
> > print "<P>Should be data sources above this linez<p>";
> >
> >
> > # Connect to database , uid, pwd, database type
> >
> > $dbh = DBI->connect( 'DB1',$user, $password, 'Oracle'
> > ) || die print "Can't connect : $DBI::errstr";
> >
> >
> > print "connected";
> >
> > print "</BODY>\n</HTML>\n";
> >
> > my $rc = $dbh->disconnect || warn $dbh->errstr;
> >
> >
> > Trace file
> >
> > DBI 1.13-nothread dispatch trace level set to 9
> > -> DBI->install_driver(Oracle) for perl=5.00503
> > pid=95 ruid=0 euid=0
> > install_driver: DBD::Oracle loaded (version
> > 1.03)
> > New DBI::dr (for DBD::Oracle::dr, parent=, id=)
> >
> > dbih_setup_handle(DBI::dr=HASH(0xe5351c)=>DBI::dr=HASH(0xeac2fc),
> > DBD::Oracle::dr, 0, Null!)
> > dbih_make_com(Null!, DBD::Oracle::dr, 84)
> > dbih_setup_attrib(DBI::dr=HASH(0xeac2fc), Err,
> > Null!) SCALAR(0xeac874) (already defined)
> > dbih_setup_attrib(DBI::dr=HASH(0xeac2fc), State,
> > Null!) SCALAR(0xe53b20) (already defined)
> > dbih_setup_attrib(DBI::dr=HASH(0xeac2fc), Errstr,
> > Null!) SCALAR(0xeac898) (already defined)
> > dbih_setup_attrib(DBI::dr=HASH(0xeac2fc),
> > Handlers, Null!) ARRAY(0xeac248) (already defined)
> > dbih_setup_attrib(DBI::dr=HASH(0xeac2fc), Debug,
> > Null!) 0 (already defined)
> > <- install_driver= DBI::dr=HASH(0xe5351c)
> > >> data_sources DISPATCH (DBI::dr=HASH(0xe5351c)
> > rc1/3 @1 g1 ab455b0) at C:\Perl\site\lib/DBI.pm line
> > 561.
> > -> data_sources for DBD::Oracle::dr
> > (DBI::dr=HASH(0xe5351c)~0xeac2fc)
> > >> debug DISPATCH (DBI::dr=HASH(0xeac2fc)
> > rc1/3 @1 g0 ab44c30) at C:\Perl\site\lib/DBD/Oracle.pm
> > line 89.
> > 2 -> debug in DBD::_::common for DBD::Oracle::dr
> > (DBI::dr=HASH(0xeac2fc)~INNER)
> > 2 <- debug= 9 at C:\Perl\site\lib/DBD/Oracle.pm line
> > 89.
> > -> DBI::END
> > >> disconnect_all DISPATCH (DBI::dr=HASH(0xe5351c)
> > rc1/3 @1 g0 ab44ad0) at C:\Perl\site\lib/DBI.pm line
> > 424.
> > -> disconnect_all for DBD::Oracle::dr
> > (DBI::dr=HASH(0xe5351c)~0xeac2fc)
> > <- disconnect_all= '' at C:\Perl\site\lib/DBI.pm
> > line 424.
> > <- DBI::END complete
> > >> DESTROY DISPATCH (DBI::dr=HASH(0xeac2fc)
> > rc1/1 @1 g0 a0) during global destruction.
> > -> DESTROY in DBD::_::common for DBD::Oracle::dr
> > (DBI::dr=HASH(0xeac2fc)~INNER)
> > <- DESTROY= undef during global destruction.
> > dbih_clearcom (h 0xe5351c, com 0xbd9cb0):
> > FLAGS 0x215: COMSET Active Warn AutoCommit
> > TYPE 1
> > PARENT undef
> > KIDS 0 (0 active)
> > IMP_DATA undef in 'DBD::Oracle::dr'
> > dbih_clearcom 0xe5351c (com 0xbd9cb0, type 1)
> > done.
> >
> > >> DESTROY DISPATCH (DBI::dr=HASH(0xe5351c)
> > rc1/1 @1 g0 a0) during global destruction.
> > <> DESTROY for DBI::dr=HASH(0xe5351c) ignored
> > (inner handle gone)
> >
> >
> >
> > ____________________________________________________________
> > Do You Yahoo!?
> > Get your free @yahoo.co.uk address at http://mail.yahoo.co.uk
> > or your free @yahoo.ie address at http://mail.yahoo.ie
>