Well, I hope this is not a duplicate, the search did not bring anything useful.
I have been practicing with cx_Oracleover the past few days, installing and using it. Everything went fine until I reached my current problem: I would like to change my scheme. If I used sqlplus simple "alter session set current_schema = toto;" but I don’t know how to get around it with cx_Oracle.
I downloaded the latest source version: cx_Oracle-5.0.2.tar.gz.
According to the documentation, changing a schema is a simple installation example Connection.current_schema, which should be a read / write attribute ... the problem in my Connectionobject has no attribute current_schema.
>>> c = cx_Oracle.connect(...)
>>> dir(c)
['__class__', '__delattr__', '__doc__', '__enter__', '__exit__', '__format__',
'__getattribute__', '__hash__', '__init__', '__new__', '__reduce__',
'__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__',
'__subclasshook__', 'autocommit', 'begin', 'cancel', 'changepassword', 'close',
'commit', 'cursor', 'dsn', 'encoding', 'inputtypehandler',
'maxBytesPerCharacter', 'nencoding', 'outputtypehandler', 'password', 'prepare',
'register', 'rollback', 'stmtcachesize', 'tnsentry', 'unregister', 'username',
'version']
Attempt to set attribute using
>>> c.current_schema = 'toto'
... __setattr__, -, , .
... - ?
, .
>>> c.current_schema = 'toto'
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'cx_Oracle.Connection' object has no attribute 'current_schema'
>>> setattr(c, 'current_schema', 'toto')
:
SUSE LINUX Enterprise Server 9 (x86_64)
VERSION = 9
PATCHLEVEL = 3
python 2.6.2 ( 64 )
cx_Oracle 64 , .