[DB-SIG] Accessing oracle from remote machine
Andy Todd
andy47 at halfcooked.com
Wed Jan 10 22:51:08 CET 2007
Sean Davis wrote:
> 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
> _______________________________________________
> DB-SIG maillist - DB-SIG at python.org
> http://mail.python.org/mailman/listinfo/db-sig
Sean,
Is there a documented source for the information about installing the
SDK? And which components does it contain?
As far as I'm aware, although I haven't tested this myself yet so I
stand ready to be corrected, you should only need the instant client and
a Python/Oracle DB-API 2.0 module to connect to a database.
Regards,
Andy
--
--------------------------------------------------------------------------------
From the desk of Andrew J Todd esq - http://www.halfcooked.com/
More information about the DB-SIG
mailing list