[DB-SIG] Accessing oracle from remote machine

Sean Davis sdavis2 at mail.nih.gov
Wed Jan 10 11:59:42 CET 2007


On Wednesday 10 January 2007 02:31, Andy Todd wrote:
> Sean Davis wrote:
> > I am new to the list, so if I am in the wrong place, feel free to direct
> > me elsewhere.
> >
> > I am trying to connect to an Oracle installation on a remote machine.  I
> > have installed the oracle instant client on my machine (linux x84_64) and
> > can connect via Oracle's sqlplus client to the remote machine.
> >
> > So, my question is what are the working options for connecting from
> > python when I do not have an entire installation in place but only
> > instantclient?
> >
> > Thanks,
> > Sean
> > _______________________________________________
> > DB-SIG maillist  -  DB-SIG at python.org
> > http://mail.python.org/mailman/listinfo/db-sig
>
> Sean,
>
> If you can connect using SQL*Plus then you can connect with a Python
> DB-API 2.0 module such as cx_Oracle [1] because they use the same
> connection mechanism. Just use the same connection string.
>
> e.g. if you use
>
> $ sqlplus scott/tiger at remotedb
>
> at the command line then in Python you can just do something like;
>
>  >>> import cx_Oracle
>  >>> remote_db = cx_Oracle.connect('scott/tiger at remotedb')
>
> I'd have a look at the documentation of whichever module you choose to
> find out how to get the best out of it though.
>
> [1] http://www.python.net/crew/atuining/cx_Oracle/

Thanks, Andy.  This is indeed the route I have gone and it works like a charm.  
Just an aside, I learned that one must install the SDK from oracle, a 
requirement above-and-beyond the standard SQL*Plus, which will work fine 
without the SDK.  A minor point, but it was cause for a bit of confusion for 
me.

Sean


More information about the DB-SIG mailing list