[DB-SIG] Accessing oracle from remote machine

Andy Todd andy47 at halfcooked.com
Wed Jan 10 08:31:42 CET 2007


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/

Regards,
Andy
-- 
--------------------------------------------------------------------------------
 From the desk of Andrew J Todd esq - http://www.halfcooked.com/


More information about the DB-SIG mailing list