Accessing Oracle width Python

Bill Scherer Bill.Scherer at VerizonWireless.com
Wed Nov 1 07:06:22 EST 2000


Nuno -

I can see that you are using DCOracle, but not as a package as it was
intended to be used.
Buffer.so an oci_.so should be in the DCOracle directory with
__init__.py, dbi.py, ociProc.py ociUtil.py, etc.  The DCOracle directory
should then be on your PYTHONPATH.

With the above completed, you can use it as such:

>>> import DCOracle
>>> db = DCOracle.Connect("user/pwd at sid")
>>> cursor = db.cursor()
>>> cursor.execute("select 2+2 from dual")
>>> result = cursor.fetchall()
>>> print result
[(4,)]
>>> cursor.close()
>>> db.close()
>>>

oracle-is-a-calculator-ly yrs,
Bill Scherer

Nuno Goncalves wrote:
> 
> Hi there ! I'm trying to access an Oracle database with python !
> 
> when i do a connect all goes ok:
> ---------------------------------------
> import Buffer, oci_, sys
> 
> def escreve():
>         print "Connecting..."
>         dbc=oci_.Connect("string")
> --------------------------------
> 
> But when i do a close it gives me the following error:
> dbc.close()
> 
> close unknow attribute
> 
> isn't a method ???
> 
> please appologiese me because i am a newby
> 
> thanks and best regards
> Nuno
> 
> --
> http://www.python.org/mailman/listinfo/python-list

-- 
William K. Scherer
Sr. Member of Applications Staff - Verizon Wireless
Bill.Scherer_at_VerizonWireless.com




More information about the Python-list mailing list