Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: ORACLE-db on remote host from perl script on win32 ?!
In article <75gvif$ad5$1_at_news.ipf.de>,
"M.Weiss" <m.weiss_at_gmx.net> wrote:
> I want to ´work on a ORACLE database running on a remote
> WinNT-server. So far I see 2 possibilities:
>
> 1. connect to the database using a module, such as DBI or DBD
> 2. use the database as a ODBC-db and connect to using
> win32::odbc.
Hi Marcus,
wow... a question that I can answer... :-)
Well, this is really quite easy (No offence!).
I would suggest connecting using SQL*NET. See DBD::Oracle for details. If you have SQL*NET installed you will need an entry for your SID in the "C:\ORANT\NETWORK\ADMIN\TNSNAMES.ORA" file:
-----------8<------------8<-------------8<------------
MYSID =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (COMMUNITY = tcp.world) (PROTOCOL = TCP) (Host = myhostname) (Port = 1521) )
Once you have this you will be able to connect from Perl...
-----------8<------------8<-------------8<------------
use DBI;
$db = DBI->connect('dbi:Oracle:MYSID','MYUSER','MYPASS')
or die "Unable to connect: $DBI::errstr";
# DO YOUR STUFF HERE!
$db->disconnect;
-----------8<------------8<-------------8<------------
The perldoc for DBD::Oracle has some useful examples. You need to have the DBI and DBD-Oracle modules installed. If you have any Oracle specific questions the comp.databases.oracle.server newsgroup is probably a better place to ask.
You could probably use ODBC (with the DBD-ODBC module) too, if you set up a "DATA-SOURCE" for the SID that you are trying to connect to. I haven't tried this myself, but suspect that you will get better performance AND better access to Oracle features if you use DBD-Oracle.
If you continue to have problems, try the TNSPING utility (C:\> tnsping mysid) to see if there is an Oracle / Network problem.
I have assumed that you are running on NT - if this is not the case the answer would be much the same anyway.
-- Regards Yuri McPhedran -----------== Posted via Deja News, The Discussion Network ==---------- http://www.dejanews.com/ Search, Read, Discuss, or Start Your OwnReceived on Mon Dec 21 1998 - 00:00:00 CST
![]() |
![]() |