RE: DBI:ORACLE with Oracle XE
am 10.07.2006 06:05:38 von pgriffinGerard,
Tnsping does work.
I have also managed to connect using the code below. But I'm unable to
connect any other way. I'm missing something obvious so if any one can tell
me what this is it would really be appreciated
$dbh = DBI->connect('dbi:Oracle:', q{uid/pwd@(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = LDPM2001AUS)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = XE)
)
)},"") or die DBI::errstr;
@tables = $dbh->tables();
foreach $table (@tables) {
print "Table : $table\n";
}
Regards Paul...
-----Original Message-----
From: Gerard [mailto:GerardHoran@gmail.com]
Sent: Monday, 10 July 2006 12:59 PM
To: Paul Griffin
Subject: Re: DBI:ORACLE with Oracle XE
Does tnsping work?
What OS are you on?
gerard
Paul Griffin wrote:
> I can connect to an Oracle XE database with dbi:ODBC using :
>
>
>
> $dbh = DBI->connect("dbi:ODBC:PSTORA01", "uid", "pwd") or die DBI::errstr;
>
>
>
> But am unable to connect with dbi:ORACLE using :
>
>
>
> $dbh = DBI->connect("dbi:Oracle:PSTORA01", "uid", "pwd") or die
DBI::errstr;
>
>
>
> Each time I get the following error :
>
>
>
> DBI connect('PSTORA01','system',...) failed: ORA-12154: TNS:could not
> resolve the connect identifier specified (DBD ERROR: OCIServerAttach) at
> C:\Projects\PST-Repository\Perl\oracle_01.pl line 10
>
> ORA-12154: TNS:could not resolve the connect identifier specified (DBD
> ERROR: OCIServerAttach) at C:\Projects\PST-Repository\Perl\oracle_01.pl
line
> 10.
>
> *** Process "C:\Perl\bin\perl.exe" terminated. Return code=255
>
> med>
>
>
>
>
>
> I'm using XP SP2 with Perl v5.8.8 and DBD-Oracle v1.17.
>
>
>
> Any suggestions/help appreciated.
>
>
>
> Regards Paul...
>
>
> ------_=_NextPart_001_01C69FB3.69C5A240
> Content-Type: text/html; charset=utf-8
> Content-Transfer-Encoding: quoted-printable
> X-Google-AttachSize: 4849
>
>
> xmlns=3D"http://www.w3.org/TR/REC-html40">
>
>
> > charset=3Dus-ascii">
>
>
>
>
>
>
>
>
>
>
>
>
> style=3D'font-size:10.0pt;
> font-family:Arial'>I can connect to an Oracle XE database with dbi:ODBC =
> using :
>
>
> style=3D'font-size:10.0pt;
> font-family:Arial'>
>
>
> style=3D'font-size:10.0pt;
> font-family:Arial'>$dbh =3D =
> DBI->connect("dbi:ODBC:PSTORA01", "uid",
> "pwd") or die DBI::errstr;
>
>
> style=3D'font-size:10.0pt;
> font-family:Arial'>
>
>
> style=3D'font-size:10.0pt;
> font-family:Arial'>But am unable to connect with dbi:ORACLE using =
> :
>
>
> style=3D'font-size:10.0pt;
> font-family:Arial'>
>
>
> style=3D'font-size:10.0pt;
> font-family:Arial'>$dbh =3D =
> DBI->connect("dbi:Oracle:PSTORA01",
> "uid", "pwd") or die =
> DBI::errstr;
>
>
> style=3D'font-size:10.0pt;
> font-family:Arial'>
>
>
> style=3D'font-size:10.0pt;
> font-family:Arial'>Each time I get the following error =
> :
>
>
> style=3D'font-size:10.0pt;
> font-family:Arial'>
>
>
> style=3D'font-size:10.0pt;
> font-family:Arial'>DBI connect('PSTORA01','system',...) failed: =
> ORA-12154:
> TNS:could not resolve the connect identifier specified (DBD ERROR:
> OCIServerAttach) at C:\Projects\PST-Repository\Perl\oracle_01.pl line =
> 10
>
>
> style=3D'font-size:10.0pt;
> font-family:Arial'>ORA-12154: TNS:could not resolve the connect =
> identifier specified
> (DBD ERROR: OCIServerAttach) at =
> C:\Projects\PST-Repository\Perl\oracle_01.pl
> line 10.
>
>
> style=3D'font-size:10.0pt;
> font-family:Arial'>*** Process "C:\Perl\bin\perl.exe" =
> terminated.
> Return code=3D255
>
>
> style=3D'font-size:10.0pt;
> font-family:Arial'>med>
>
>
> style=3D'font-size:10.0pt;
> font-family:Arial'>
>
>
> style=3D'font-size:10.0pt;
> font-family:Arial'>
>
>
> style=3D'font-size:10.0pt;
> font-family:Arial'>I’m using XP SP2 with Perl v5.8.8 and =
> DBD-Oracle v1.17.
>
>
> style=3D'font-size:10.0pt;
> font-family:Arial'>
>
>
> style=3D'font-size:10.0pt;
> font-family:Arial'>Any suggestions/help =
> appreciated.
>
>
> style=3D'font-size:10.0pt;
> font-family:Arial'>
>
> > style=3D'mso-margin-top-alt:auto;mso-margin-bottom-alt:auto' > > size=3D2 face=3DArial> > style=3D'font-size:10.0pt;font-family:Arial'>Regards
> Paul…
>
>
>
>
>
>
>
>
> ------_=_NextPart_001_01C69FB3.69C5A240--