Errors, Connecting to Oracle



Hi List.

I've installed Oracle on my linux box (SuSE 10) and I've installed
DBD::Oracle.

I can run sqlplus as the oracle user however when I try and connect via
DBD::Oracle in a perl script I always get errors as follows:

connect string =
my $dbh = DBI->connect("dbi:Oracle:ORCL", 'oracle', 'oracle' );

error =
DBI connect('ORCL','oracle',...) failed: ORA-12541: TNS:no listener (DBD
ERROR: OCIServerAttach) at ora1.pl line 7
Connection Failed...

connect string =
my $dbh = DBI->connect("dbi:Oracle:HOST=linux.site;SID=ORCL;PORT=1522",
'oracle', 'oracle' );

error =
DBI connect('HOST=linux.site;SID=ORCL;PORT=1522','oracle',...) failed:
ORA-12541: TNS:no listener (DBD ERROR: OCIServerAttach) at ora1.pl line 7
Connection Failed...



Maybe I have the connect string wrong?


Below is a listing of my code, and my tnsnames.ora:
Thanks in advance for your help.


############ code listing ################ #!/usr/bin/perl

use DBI;

print "Started\n";

my $dbh = DBI->connect("dbi:Oracle:HOST=linux.site;SID=ORCL;PORT=1522",
'oracle', 'oracle' );


if ($dbh) {
print "Connected...\n";
}
else {
print "Connection Failed...\n";
exit;
}

my $qry = $dbh->prepare("select count(*) from dba_tables");
$qry->execute();

my @data = $qry->fetchrow_array();

print "[$data[0]] [$data[1]] [$data[2]]\n";


exit;




######### tnsnames.ora listing #####################
# Generated by Oracle configuration tools.

LISTENER_ORCL =
(ADDRESS = (PROTOCOL = TCP)(HOST = linux.site)(PORT = 1522))


ORCL =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = linux.site)(PORT = 1522))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcl)
)
)

EXTPROC_CONNECTION_DATA =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC2))
)
(CONNECT_DATA =
(SID = PLSExtProc)
(PRESENTATION = RO)
)
)



.



Relevant Pages

  • Re: Query Oracle from Excel
    ... You will need the Oracle client sofware installed on the PC you're running ... What exactly is DBDataProvider and DBDataSource? ... Global prmUsername As String ... Dim adoConn As New ADODB.Connection ...
    (microsoft.public.excel.programming)
  • RE: Query Oracle from Excel
    ... Ron, thanks for your help...this is REALLY helping me!!!! ... Now, let's say that Oracle resides on the LAN/WAN somewhere, and I don't ... Global prmUsername As String ... Dim adoConn As New ADODB.Connection ...
    (microsoft.public.excel.programming)
  • Re: Oracle 11g R1 WinXP SP2 CPU 100 percent all the time
    ... I've installed Oracle trial/demo EE software  Win XP SP2 ... Have you checked the alert log for the database instance or the ... ns secondary err code: 12606 ...
    (comp.databases.oracle.server)
  • Re: Re-logging into An Oracle Database
    ... I've done it in MS SQL but never in Oracle. ... My connection string seems to work, but the app seems to keep the old userid so I can't see the tables I need to see. ... What I prefer to do is use PTQs is to run updates via VBA, something like this. ... 'no error handling included here for this post, but error procs can be included to return a false for this function of the query does not execute. ...
    (comp.databases.ms-access)
  • RE: $dbh->tables() printing error messages for Oracle under Cygwi n pe rl 5.8
    ... $dbh->tablesprinting error messages for Oracle under ... > Use of uninitialized value in string eq at ... Give a hobbit a ring and he eats fish for an age. ...
    (perl.dbi.users)