cx-oracle-users Mailing List for cx_Oracle (Page 38)
Brought to you by:
atuining
You can subscribe to this list here.
2003 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(5) |
Aug
(9) |
Sep
(8) |
Oct
(12) |
Nov
(4) |
Dec
(8) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2004 |
Jan
(15) |
Feb
(12) |
Mar
(11) |
Apr
(5) |
May
(7) |
Jun
(8) |
Jul
(12) |
Aug
(2) |
Sep
(14) |
Oct
(17) |
Nov
(20) |
Dec
(3) |
2005 |
Jan
(16) |
Feb
(9) |
Mar
(22) |
Apr
(21) |
May
(73) |
Jun
(16) |
Jul
(15) |
Aug
(10) |
Sep
(32) |
Oct
(35) |
Nov
(22) |
Dec
(13) |
2006 |
Jan
(42) |
Feb
(36) |
Mar
(13) |
Apr
(18) |
May
(8) |
Jun
(17) |
Jul
(24) |
Aug
(30) |
Sep
(35) |
Oct
(33) |
Nov
(33) |
Dec
(11) |
2007 |
Jan
(35) |
Feb
(31) |
Mar
(35) |
Apr
(64) |
May
(38) |
Jun
(12) |
Jul
(18) |
Aug
(34) |
Sep
(75) |
Oct
(29) |
Nov
(51) |
Dec
(11) |
2008 |
Jan
(27) |
Feb
(46) |
Mar
(48) |
Apr
(36) |
May
(59) |
Jun
(42) |
Jul
(25) |
Aug
(34) |
Sep
(57) |
Oct
(97) |
Nov
(59) |
Dec
(57) |
2009 |
Jan
(48) |
Feb
(48) |
Mar
(45) |
Apr
(24) |
May
(46) |
Jun
(52) |
Jul
(52) |
Aug
(37) |
Sep
(27) |
Oct
(40) |
Nov
(37) |
Dec
(13) |
2010 |
Jan
(16) |
Feb
(9) |
Mar
(24) |
Apr
(6) |
May
(27) |
Jun
(28) |
Jul
(60) |
Aug
(16) |
Sep
(33) |
Oct
(20) |
Nov
(39) |
Dec
(30) |
2011 |
Jan
(23) |
Feb
(43) |
Mar
(16) |
Apr
(29) |
May
(23) |
Jun
(16) |
Jul
(10) |
Aug
(8) |
Sep
(18) |
Oct
(42) |
Nov
(26) |
Dec
(20) |
2012 |
Jan
(17) |
Feb
(27) |
Mar
|
Apr
(20) |
May
(18) |
Jun
(7) |
Jul
(24) |
Aug
(21) |
Sep
(23) |
Oct
(18) |
Nov
(12) |
Dec
(5) |
2013 |
Jan
(14) |
Feb
(10) |
Mar
(20) |
Apr
(65) |
May
(3) |
Jun
(8) |
Jul
(6) |
Aug
(3) |
Sep
|
Oct
(3) |
Nov
(28) |
Dec
(3) |
2014 |
Jan
(3) |
Feb
(9) |
Mar
(4) |
Apr
(7) |
May
(20) |
Jun
(2) |
Jul
(20) |
Aug
(7) |
Sep
(11) |
Oct
(8) |
Nov
(6) |
Dec
(12) |
2015 |
Jan
(16) |
Feb
(10) |
Mar
(14) |
Apr
(8) |
May
|
Jun
(8) |
Jul
(15) |
Aug
(7) |
Sep
(1) |
Oct
(33) |
Nov
(8) |
Dec
(5) |
2016 |
Jan
(18) |
Feb
(12) |
Mar
(6) |
Apr
(14) |
May
(5) |
Jun
(3) |
Jul
|
Aug
(21) |
Sep
|
Oct
(15) |
Nov
(8) |
Dec
|
2017 |
Jan
|
Feb
(14) |
Mar
(21) |
Apr
(9) |
May
(6) |
Jun
(11) |
Jul
(23) |
Aug
(6) |
Sep
(5) |
Oct
(7) |
Nov
(1) |
Dec
(1) |
2018 |
Jan
|
Feb
|
Mar
(16) |
Apr
(2) |
May
(1) |
Jun
|
Jul
(2) |
Aug
|
Sep
(2) |
Oct
|
Nov
|
Dec
|
2019 |
Jan
(2) |
Feb
(3) |
Mar
(1) |
Apr
(1) |
May
|
Jun
|
Jul
(2) |
Aug
(1) |
Sep
(2) |
Oct
|
Nov
|
Dec
(1) |
2020 |
Jan
|
Feb
(4) |
Mar
|
Apr
|
May
(2) |
Jun
(1) |
Jul
(4) |
Aug
|
Sep
(1) |
Oct
|
Nov
|
Dec
(3) |
2021 |
Jan
|
Feb
(5) |
Mar
|
Apr
(7) |
May
(6) |
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(1) |
Dec
|
2022 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2023 |
Jan
|
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Wong W. Meng-R. <r3...@fr...> - 2011-10-13 05:42:42
|
Hello guys, Can anyone advise why am I hitting invalid number error when trying to update a NUMBER field using parameters? The first SQL update works, however, not the second one. Is there a different way I need to pass to cx_Oracle if the parameter were a NUMBER field? SQL 1 (successful) >>> a.execute("update USERS set USER_LOGIN_FAILURE_ATTEMPT = 1 where USER_ID = 'ftcs'") SQL 2 (failed) >>> a.execute("update USERS set USER_LOGIN_FAILURE_ATTEMPT = :2 where USER_ID = :1", ('ftcs', 1)) Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/home/r32813/genesis/GEN_DEV_271/Product/Lib/EComponent.py", line 821, in __call__ self._method, args, kw ) File "/home/r32813/genesis/GEN_DEV_271/Product/Lib/RMI.py", line 1779, in _genericInvocation reply = self._requestReply( replyBit, (method_name, args, kw) ) File "/home/r32813/genesis/GEN_DEV_271/Product/Lib/RMI.py", line 1612, in _requestReply reply = self._postReceive(reply) File "/home/r32813/genesis/GEN_DEV_271/Product/Lib/RMI.py", line 1748, in _postReceive raise ValueError(post_msg[1]) # raise application-level exception ValueError: ORA-01722: invalid number USER_LAST_PW4_CHANGE DATE USER_OLD_PW5 VARCHAR2(30) USER_LAST_PW5_CHANGE DATE USER_LOGIN_FAILURE_ATTEMPT NUMBER REASON VARCHAR2(64) USER_LOGIN_FAILURE_REASON VARCHAR2(64) USER_LAST_LOGIN_DATE DATE USER_HR_DEPT VARCHAR2(10) Regards, Wah Meng |
From: Anthony T. <ant...@gm...> - 2011-10-13 03:50:37
|
Hi, Check how many rows were updated by looking at cursor.rowcount. At a guess you are using a CHAR column instead of a VARCHAR2 column and they behave differently. :-) Anthony On Sun, Oct 9, 2011 at 5:42 AM, Wong Wah Meng-R32813 <r3...@fr...> wrote: > Hello there, > > > > I continue to work on my application migration from python 1.5.2 to 2.7.1, > from using oracledb to cx_Oracle in a python RMI framework. > > > > I am troubleshooting this issue whereby my API is updating userLastName of a > given userId. I am doing cursor.execute(“update……”) first then > connection.commit(). However, the data in the database doesn’t seem changed, > which means the “commit” did not get through. There is no error generated > when “.commit()” is executed though. > > > > I am thinking my API might be using different connection objects to do the > cursor.execute() and connection.commit(), respectively however the > likelihood is low, as the old code using oracledb was working well. > > > > Does anyone has any idea how this can happen? > > > > > > Source code….. > > > > def _processDB( self, conn_type, conn, cursor, db_type, db_msg ): > > """Internal method to execute the database transaction given.""" > > > > reply_error = None > > try: > > print ">>>> _processDB : conn_type=%s, db_type=%s, > db_msg=%s"%(conn_type, db_type, db_msg) > > if db_type == STMT_EXEC: > > msg, arg = db_msg > > if arg: > > reply_value = cursor.execute( msg, arg ) > > else: > > reply_value = cursor.execute( msg ) > > if reply_value == None: # none-select statement > > if conn_type == GENERAL_CONN: > > conn.commit() > > else: > > reply_value = cursor.fetchall() > > > > elif db_type == STMT_EXECL: > > msg, arg = db_msg > > if arg: > > reply_value = cursor.execute( msg, arg ) > > else: > > reply_value = cursor.execute( msg ) > > if reply_value == None: # select statement > > reply_value = cursor.fetchall() > > # get description > > desc_list = cursor.description > > desc = [] > > for i in desc_list: > > desc.append( i[0] ) > > reply_value.insert( 0, tuple(desc) ) > > else: > > if conn_type == GENERAL_CONN: > > conn.commit() > > > > elif db_type == STMT_PROC: > > reply_value = conn.callproc( db_msg ) > > > > elif db_type == STMT_COMMIT: > > print "Hello world" > > reply_value = conn.commit() > > > > elif db_type == STMT_ROLLBACK: > > reply_value = conn.rollback() > > > > > > print ">>>> _processDB : reply_value = %s"%(reply_value,) > > > > > > Debug Printout > > > >>>>> _processDB : conn_type=1, db_type=exec, db_msg=('select sysdate from >>>>> sys.dual', ()) > >>>>> _processDB : reply_value = [(datetime.datetime(2011, 10, 9, 19, 25, >>>>> 39),)] > >>>>> _processDB : conn_type=1, db_type=exec, db_msg=("select 1 from USERS >>>>> where USER_ID = 'ftcs' and ROWNUM = 1", ()) > >>>>> _processDB : reply_value = [(1,)] > >>>>> _processDB : conn_type=1, db_type=exec, db_msg=('update USERS set >>>>> USER_MODIFY_USER = :2, USER_MODIFY_DATE = :3, USER_FIRST_NAME = :4 where >>>>> USER_ID = :1', ['ftcs', 'ftcs', datetime.datetime(2011, 10, 9, 19, 25, 39), >>>>> 'Steven II']) > >>>>> _processDB : reply_value = None > >>>>> _processDB : conn_type=1, db_type=commit, db_msg=commit > > Hello world > >>>>> _processDB : reply_value = None > > > > > > Regards, > > Wah Meng > > Genesis Wafermap Support Ticket: > > To report a problem: > http://dyno.freescale.net/Question/QuestionMain3.asp?location=zmy02&category=&tickettype=6820 > > To request a service: > http://dyno.freescale.net/Question/Questionmain3.asp?location=74&category=2&tickettype=6819 > > Or if it is related to EWM or DSA: > http://dyno.freescale.net/Question/Questionmain3.asp?location=ZMY02&tickettype=6539 > > > > ------------------------------------------------------------------------------ > All of the data generated in your IT infrastructure is seriously valuable. > Why? It contains a definitive record of application performance, security > threats, fraudulent activity, and more. Splunk takes this data and makes > sense of it. IT sense. And common sense. > http://p.sf.net/sfu/splunk-d2dcopy2 > _______________________________________________ > cx-oracle-users mailing list > cx-...@li... > https://lists.sourceforge.net/lists/listinfo/cx-oracle-users > > |
From: Wong W. Meng-R. <r3...@fr...> - 2011-10-12 07:53:54
|
Hello Amaury, Thanks a lot! Overriding the inputtypehandler works. Since my application is sending date as tuple but cx_Oracle.Timestamp() is expecting 6 argument in integer, I wrote another converter function and use it against inputtypehandler. Now I need to plug this into my application Once again, thanks! :) $ python Python 2.7.1 (r271:86832, Oct 6 2011, 11:10:10) [C] on hp-ux11 Type "help", "copyright", "credits" or "license" for more information. >>> import cx_Oracle >>> c=cx_Oracle.connect("gen812ora8/gen812db1ora8@DB1ORA9") >>> a=c.cursor() >>> def convertT2D(x): ... return cx_Oracle.Timestamp(x[0], x[1], x[2], x[3], x[4], x[5]) ... >>> def inputtypehandler(cursor, value, arraysize): ... if isinstance(value, tuple): ... return cursor.var(cx_Oracle.DATETIME, arraysize=arraysize, inconverter=convertT2D) ... >>> a.inputtypehandler=inputtypehandler >>> a.execute("update users set user_last_name=:1, user_first_name=:2, USER_MODIFY_DATE=:3 where user_id=:4", ('XXXXX', 'YYYY', (2011, 10, 11, 11, 11, 11), 'ftcs')) >>> c.commit() >>> SQL> select user_last_name, user_first_name, USER_MODIFY_DATE from users where user_id='ftcs'; USER_LAST_NAME USER_FIRST_NAME USER_MODI -------------------- -------------------- --------- XXXXX YYYY 11-OCT-11 Regards, Wah Meng ________________________________ From: Amaury Forgeot d'Arc [mailto:ama...@gm...] Sent: Tuesday, October 11, 2011 8:16 PM To: cx-...@li... Subject: Re: [cx-oracle-users] Another oracledb to cxOracle Migration Issue: Parsing to and from Column in DATE type Hi, 2011/10/11 Wong Wah Meng-R32813 <r3...@fr...<mailto:r3...@fr...>>: > Yesterday I posted the issue about returning data to client application > written in python 1.5.2, whereby the client application is not able to > recognize data in date form which is wrapped with datetime type. > > I applied some code in the server side, written in python 2.7.2 using > cx_Oracle, which converts every date data returned from a cursor object to a > tuple format date, before returning it to the client. This at least works > for me which at the moment I can't upgrade my clients to the same version of > python my server has. > > Now I need to solve another issue arising from SQL update/insert/delete > statements whereby the passing in data should be in datetime format. > Previously this works well in my server application written in python 1.5.2 > using oracledb. Execute() can recognize the first argument is a tuple > representing the date. > > a.execute("update wafers set first_issue_date=:1 where wafr_number=:2", > (2011, 10, 11, 19, 6, 40), 'DD73165.1C.12D0')) > > However I realize above doesn't work in cx_Oracle. I need to covert the > tuple to a datetime object before passing it into the Execute() statement. > > a.execute("update wafers set first_issue_date=:1 where wafr_number=:2", > (cx_Oracle.Timestamp(2011, 10, 11, 19, 6, 40), 'DD73165.1C.12D0')) > > Again, is there anyway this can be made backward compatible to python 1.5.2 > whereby it can just accept date in tuple format? I may not be able to apply > a generic parser for this one for all API as possibly there could be other > data which is also a 6 element tuple but not in date context. It looks like > I need to change it at each server API level as only the API level knows the > context of each data to be sent to the Oracle in the insert/update/delete > statement. > > Appreciate your input in advance. > >>>> a.execute("update wafers set first_issue_date=:1 where wafr_number=:2", >>>> ((2011, 10, 11, 19, 6, 40), 'DD73165.1C.12D0')) > Traceback (most recent call last): > File "<stdin>", line 1, in <module> > File "/home/r32813/genesis/GEN_DEV_271/Product/Lib/EComponent.py", line > 821, in __call__ > self._method, args, kw ) > File "/home/r32813/genesis/GEN_DEV_271/Product/Lib/RMI.py", line 1779, in > _genericInvocation > reply = self._requestReply( replyBit, (method_name, args, kw) ) > File "/home/r32813/genesis/GEN_DEV_271/Product/Lib/RMI.py", line 1612, in > _requestReply > reply = self._postReceive(reply) > File "/home/r32813/genesis/GEN_DEV_271/Product/Lib/RMI.py", line 1748, in > _postReceive > raise ValueError(post_msg[1]) # raise application-level exception > ValueError: Variable_TypeByValue(): unhandled data type tuple You could use a Connection.inputtypehandler, either on the connection or the cursor object: http://cx-oracle.sourceforge.net/html/connection.html#Connection.inputtypehandler Maybe something like this (did not test): def inputtypehandler(cursor, value, arraysize): if instance(value, tuple): var = cursor.var(cx_Oracle.DATETIME, arraysize=arraysize, inconverter=cx_Oracle.Timestamp) return var a.inputtypehandler = inputtypehandler -- Amaury Forgeot d'Arc |
From: Anthony T. <ant...@gm...> - 2011-10-12 02:43:51
|
What is cx_Oracle? cx_Oracle is a Python extension module that allows access to Oracle and conforms to the Python database API 2.0 specifications with a few exceptions. Where do I get it? http://cx-oracle.sourceforge.net What's new? 1) Simplify management of threads for callbacks performed by database change notification and eliminate a crash that occurred under high load in certain situations. Thanks to Calvin S. for noting the issue and suggesting a solution and testing the patch. 2) Force server detach on close so that the connection is completely closed and not just the session as before. 3) Force use of OCI_UTF16ID for NCLOBs as using the default character set would result in ORA-03127 with Oracle 11.2.0.2 and UTF8 character set. 4) Avoid attempting to clear temporary LOBs a second time when destroying the variable as in certain situations this results in spurious errors. 5) Added additional parameter service_name to makedsn() which can be used to use the service_name rather than the SID in the DSN string that is generated. 6) Fix cursor description in test suite to take into account the number of bytes per character. 7) Added tests for NCLOBS to the test suite. 8) Removed redundant code in setup.py for calculating the library path. |
From: Tamás G. <gt...@gt...> - 2011-10-11 13:22:39
|
Hi, > Date: Tue, 11 Oct 2011 11:46:00 +0000 > From: Wong Wah Meng-R32813 <r3...@fr...> > Subject: [cx-oracle-users] Another oracledb to cxOracle Migration > Issue: Parsing to and from Column in DATE type > To: "cx-...@li..." > <cx-...@li...> > Message-ID: > <02E...@03...> > > Content-Type: text/plain; charset="us-ascii" > > Hello guys, > > Yesterday I posted the issue about returning data to client application written in python 1.5.2, whereby the client application is not able to recognize data in date form which is wrapped with datetime type. > > I applied some code in the server side, written in python 2.7.2 using cx_Oracle, which converts every date data returned from a cursor object to a tuple format date, before returning it to the client. This at least works for me which at the moment I can't upgrade my clients to the same version of python my server has. > > Now I need to solve another issue arising from SQL update/insert/delete statements whereby the passing in data should be in datetime format. Previously this works well in my server application written in python 1.5.2 using oracledb. Execute() can recognize the first argument is a tuple representing the date. > > a.execute("update wafers set first_issue_date=:1 where wafr_number=:2", (2011, 10, 11, 19, 6, 40), 'DD73165.1C.12D0')) > > However I realize above doesn't work in cx_Oracle. I need to covert the tuple to a datetime object before passing it into the Execute() statement. > > a.execute("update wafers set first_issue_date=:1 where wafr_number=:2", (cx_Oracle.Timestamp(2011, 10, 11, 19, 6, 40), 'DD73165.1C.12D0')) > > Again, is there anyway this can be made backward compatible to python 1.5.2 whereby it can just accept date in tuple format? I may not be able to apply a generic parser for this one for all API as possibly there could be other data which is also a 6 element tuple but not in date context. It looks like I need to change it at each server API level as only the API level knows the context of each data to be sent to the Oracle in the insert/update/delete statement. > > Appreciate your input in advance. You should subclass cx_Oracle.Cursor and override its execute method, to convert each input parameter as needed (from tuple to datetime.datetime). Here you can override the next method, too, to have it convert from datetime to tuple (or use a general rowfactory). GThomas > >>>> a.execute("update wafers set first_issue_date=:1 where wafr_number=:2", ((2011, 10, 11, 19, 6, 40), 'DD73165.1C.12D0')) > Traceback (most recent call last): > File "<stdin>", line 1, in <module> > File "/home/r32813/genesis/GEN_DEV_271/Product/Lib/EComponent.py", line 821, in __call__ > self._method, args, kw ) > File "/home/r32813/genesis/GEN_DEV_271/Product/Lib/RMI.py", line 1779, in _genericInvocation > reply = self._requestReply( replyBit, (method_name, args, kw) ) > File "/home/r32813/genesis/GEN_DEV_271/Product/Lib/RMI.py", line 1612, in _requestReply > reply = self._postReceive(reply) > File "/home/r32813/genesis/GEN_DEV_271/Product/Lib/RMI.py", line 1748, in _postReceive > raise ValueError(post_msg[1]) # raise application-level exception > ValueError: Variable_TypeByValue(): unhandled data type tuple > > Regards, > Wah Meng > > -------------- next part -------------- > An HTML attachment was scrubbed... > > ------------------------------ > > ------------------------------------------------------------------------------ > All the data continuously generated in your IT infrastructure contains a > definitive record of customers, application performance, security > threats, fraudulent activity and more. Splunk takes this data and makes > sense of it. Business sense. IT sense. Common sense. > http://p.sf.net/sfu/splunk-d2d-oct > |
From: Wong W. Meng-R. <r3...@fr...> - 2011-10-11 12:32:18
|
Hello there, Below is the message I posted up when I saw the issue of multiple oracle connection object is used in my application whereby the execute(SQL update) and commit() are done by different connection object, causing the commit doesn't commit the SQL update. I have experimented it out and confirmed the case. Is there more documentation I can refer to in order to migrate my application in old model using oracledb and mutex to the new model with cx_Oracle? I see some argument can be pass in when we do cx_Oracle.connect()? I think the old model cannot work for cx_Oracle. An example of the RMI old code is like below. I am expecting my application server to have multiple instances of oracle connection and when a client submits a API to the server, the server should use the same Oracle connection object through the entire API, so that what I saw wouldn't happen. Thanks in advance for your input. class DbQueue(Queue.Queue): def __init__(self, maxsize): Queue.Queue.__init__(self, maxsize) def showQue(self): self.mutex.acquire_lock() try: q=[] for item in self.queue: q.append((item[0],item[1], item[4])) except: pass self.mutex.release_lock() return q class DbAccessMgr( TComponent.Server ): """Component DbAccessMgr """ # ========================================================================= class ConnQueue: """"Queue of transactions, one for each database connection.""" def __init__( self ): self.owner = None self.lastSQL = None self.queue = Queue.Queue(0) # infinite-size queue def setOwner( self, owner ): self.owner = owner self.lastSQL = None def getOwner( self ): return self.owner def get( self ): nextSQL = self.queue.get() self.lastSQL = nextSQL[:2] return nextSQL def put( self, t ): self.queue.put(t) def getLastSQL(self): return self.lastSQL # # ========================================================================= class OutputBuffer: """Output buffer used to transfer database transaction result from the database processing thread to the API client thread""" def __init__( self ): self._buffer = None self._lock = thread.allocate_lock() self._ready = condition.event() def post( self, buf ): self._lock.acquire() self._buffer = buf self._lock.release() self._ready.post() def clear( self ): self._lock.acquire() self._buffer = None self._lock.release() self._ready.clear() def get( self ): self._ready.wait() return self._buffer Regards, Wah Meng GThomas, > > I am thinking my API might be using different connection objects to do the cursor.execute() and connection.commit(), respectively however the likelihood is low, as the old code using oracledb was working well. > I'm sure this is the case. You should use cursor.connection.commit() for commiting, not the other connection object! Or put an "assert conn == cursor.commit" somewhere... Ok I will work on based on this clue. I am thinking my application should use the same connection object throughout a single API. An API can execute x number of SQL query/insert/update/delete statements and if no exception is found, commit is issued at the end, otherwise rollback is issued. What I don't understand is the framework did not change, while I convert oracledb to cx_Oracle, so I wonder how each SQL in the same API transaction could be utilizing different connection objects. Another behavior I need to check is the threadSafe mode. I need to understand more on that option as I did not look into that aspect in this migration exercise. I only did one change i.e. adding on "threaded=True" to "cx_Oracle.connect()" when I spawn off multiple threads creating the connection objects. I will revert after researching and testing. Thanks! Regards, Wah Meng |
From: Amaury F. d'A. <ama...@gm...> - 2011-10-11 12:16:32
|
Hi, 2011/10/11 Wong Wah Meng-R32813 <r3...@fr...>: > Yesterday I posted the issue about returning data to client application > written in python 1.5.2, whereby the client application is not able to > recognize data in date form which is wrapped with datetime type. > > I applied some code in the server side, written in python 2.7.2 using > cx_Oracle, which converts every date data returned from a cursor object to a > tuple format date, before returning it to the client. This at least works > for me which at the moment I can’t upgrade my clients to the same version of > python my server has. > > Now I need to solve another issue arising from SQL update/insert/delete > statements whereby the passing in data should be in datetime format. > Previously this works well in my server application written in python 1.5.2 > using oracledb. Execute() can recognize the first argument is a tuple > representing the date. > > a.execute("update wafers set first_issue_date=:1 where wafr_number=:2", > (2011, 10, 11, 19, 6, 40), 'DD73165.1C.12D0')) > > However I realize above doesn’t work in cx_Oracle. I need to covert the > tuple to a datetime object before passing it into the Execute() statement. > > a.execute("update wafers set first_issue_date=:1 where wafr_number=:2", > (cx_Oracle.Timestamp(2011, 10, 11, 19, 6, 40), 'DD73165.1C.12D0')) > > Again, is there anyway this can be made backward compatible to python 1.5.2 > whereby it can just accept date in tuple format? I may not be able to apply > a generic parser for this one for all API as possibly there could be other > data which is also a 6 element tuple but not in date context. It looks like > I need to change it at each server API level as only the API level knows the > context of each data to be sent to the Oracle in the insert/update/delete > statement. > > Appreciate your input in advance. > >>>> a.execute("update wafers set first_issue_date=:1 where wafr_number=:2", >>>> ((2011, 10, 11, 19, 6, 40), 'DD73165.1C.12D0')) > Traceback (most recent call last): > File "<stdin>", line 1, in <module> > File "/home/r32813/genesis/GEN_DEV_271/Product/Lib/EComponent.py", line > 821, in __call__ > self._method, args, kw ) > File "/home/r32813/genesis/GEN_DEV_271/Product/Lib/RMI.py", line 1779, in > _genericInvocation > reply = self._requestReply( replyBit, (method_name, args, kw) ) > File "/home/r32813/genesis/GEN_DEV_271/Product/Lib/RMI.py", line 1612, in > _requestReply > reply = self._postReceive(reply) > File "/home/r32813/genesis/GEN_DEV_271/Product/Lib/RMI.py", line 1748, in > _postReceive > raise ValueError(post_msg[1]) # raise application-level exception > ValueError: Variable_TypeByValue(): unhandled data type tuple You could use a Connection.inputtypehandler, either on the connection or the cursor object: http://cx-oracle.sourceforge.net/html/connection.html#Connection.inputtypehandler Maybe something like this (did not test): def inputtypehandler(cursor, value, arraysize): if instance(value, tuple): var = cursor.var(cx_Oracle.DATETIME, arraysize=arraysize, inconverter=cx_Oracle.Timestamp) return var a.inputtypehandler = inputtypehandler -- Amaury Forgeot d'Arc |
From: Wong W. Meng-R. <r3...@fr...> - 2011-10-11 11:46:16
|
Hello guys, Yesterday I posted the issue about returning data to client application written in python 1.5.2, whereby the client application is not able to recognize data in date form which is wrapped with datetime type. I applied some code in the server side, written in python 2.7.2 using cx_Oracle, which converts every date data returned from a cursor object to a tuple format date, before returning it to the client. This at least works for me which at the moment I can't upgrade my clients to the same version of python my server has. Now I need to solve another issue arising from SQL update/insert/delete statements whereby the passing in data should be in datetime format. Previously this works well in my server application written in python 1.5.2 using oracledb. Execute() can recognize the first argument is a tuple representing the date. a.execute("update wafers set first_issue_date=:1 where wafr_number=:2", (2011, 10, 11, 19, 6, 40), 'DD73165.1C.12D0')) However I realize above doesn't work in cx_Oracle. I need to covert the tuple to a datetime object before passing it into the Execute() statement. a.execute("update wafers set first_issue_date=:1 where wafr_number=:2", (cx_Oracle.Timestamp(2011, 10, 11, 19, 6, 40), 'DD73165.1C.12D0')) Again, is there anyway this can be made backward compatible to python 1.5.2 whereby it can just accept date in tuple format? I may not be able to apply a generic parser for this one for all API as possibly there could be other data which is also a 6 element tuple but not in date context. It looks like I need to change it at each server API level as only the API level knows the context of each data to be sent to the Oracle in the insert/update/delete statement. Appreciate your input in advance. >>> a.execute("update wafers set first_issue_date=:1 where wafr_number=:2", ((2011, 10, 11, 19, 6, 40), 'DD73165.1C.12D0')) Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/home/r32813/genesis/GEN_DEV_271/Product/Lib/EComponent.py", line 821, in __call__ self._method, args, kw ) File "/home/r32813/genesis/GEN_DEV_271/Product/Lib/RMI.py", line 1779, in _genericInvocation reply = self._requestReply( replyBit, (method_name, args, kw) ) File "/home/r32813/genesis/GEN_DEV_271/Product/Lib/RMI.py", line 1612, in _requestReply reply = self._postReceive(reply) File "/home/r32813/genesis/GEN_DEV_271/Product/Lib/RMI.py", line 1748, in _postReceive raise ValueError(post_msg[1]) # raise application-level exception ValueError: Variable_TypeByValue(): unhandled data type tuple Regards, Wah Meng |
From: Wong W. Meng-R. <r3...@fr...> - 2011-10-10 09:02:43
|
Hello guys, Something new I discovered in migrating my application from python 1.5.2 to 2.7.1, from oracledb to cx_Oracle. I noticed that data with date as the column type, is returned from a SQL query wrapped with datetime.datetime(). This has caused my clients which in a lower version of python unable to parse it. While converting my client to python 2.7.1 may solve the problem, I have a constraint of keeping the client at python 1.5.2 at the moment. Is there a way to "switch off" the prefix or the wrapper from the application server where the python version is higher? I will definitely work on migrating client to 2.7.1 as well however I must go through the stage of keeping client at 1.5.2 for a while before converting. Hope to hear some solution out here. Python 1.5.2 >>> a.execute("select USER_ENTER_DATE, USER_MODIFY_DATE, USER_LAST_PW_CHANGE, USER_LAST_PW2_CHANGE, USER_LAST_PW3_CHANGE, USER_LAST_LOGIN_DATE, USER_STATUS_CHANGE_DATE from users where USER_ID='EC733'") Traceback (innermost last): File "<stdin>", line 1, in ? File "D:\genesis\Product\Lib\RMI.py", line 1765, in __call__ raise sys.exc_type, sys.exc_value ImportError: No module named datetime >>> Python 2.7.1 >>> d.execute("select USER_ENTER_DATE, USER_MODIFY_DATE, USER_LAST_PW_CHANGE, USER_LAST_PW2_CHANGE, USER_LAST_PW3_CHANGE, USER_LAST_LOGIN_DATE, USER_STATUS_CHANGE_DATE from users where USER_ID='EC733'") [(datetime.datetime(2000, 4, 24, 14, 30, 13), datetime.datetime(2010, 3, 6, 2, 42, 27), datetime.datetime(2011, 3, 2, 10, 19, 54), datetime.datetime(2011, 1, 7, 10, 18, 58), datetime.datetime(2010, 12, 8, 11, 5, 38), datetime.datetime(2011, 3, 2, 10, 30, 31), datetime.datetime(2011, 3, 2, 10, 30, 31))] Regards, Wah Meng |
From: Wong W. Meng-R. <r3...@fr...> - 2011-10-10 03:12:01
|
GThomas, > > I am thinking my API might be using different connection objects to do the cursor.execute() and connection.commit(), respectively however the likelihood is low, as the old code using oracledb was working well. > I'm sure this is the case. You should use cursor.connection.commit() for commiting, not the other connection object! Or put an "assert conn == cursor.commit" somewhere... Ok I will work on based on this clue. I am thinking my application should use the same connection object throughout a single API. An API can execute x number of SQL query/insert/update/delete statements and if no exception is found, commit is issued at the end, otherwise rollback is issued. What I don't understand is the framework did not change, while I convert oracledb to cx_Oracle, so I wonder how each SQL in the same API transaction could be utilizing different connection objects. Another behavior I need to check is the threadSafe mode. I need to understand more on that option as I did not look into that aspect in this migration exercise. I only did one change i.e. adding on "threaded=True" to "cx_Oracle.connect()" when I spawn off multiple threads creating the connection objects. I will revert after researching and testing. Thanks! Regards, Wah Meng |
From: Tamás G. <gt...@gt...> - 2011-10-09 11:55:45
|
Hi, > Date: Sun, 9 Oct 2011 11:42:13 +0000 > From: Wong Wah Meng-R32813 <r3...@fr...> > Subject: [cx-oracle-users] cursor.execute() then conn.commit however > SQL update not committed in database > To: "cx-...@li..." > <cx-...@li...> > Message-ID: > <02E...@03...> > > Content-Type: text/plain; charset="us-ascii" > > Hello there, > > I continue to work on my application migration from python 1.5.2 to 2.7.1, from using oracledb to cx_Oracle in a python RMI framework. > > I am troubleshooting this issue whereby my API is updating userLastName of a given userId. I am doing cursor.execute("update......") first then connection.commit(). However, the data in the database doesn't seem changed, which means the "commit" did not get through. There is no error generated when ".commit()" is executed though. > > I am thinking my API might be using different connection objects to do the cursor.execute() and connection.commit(), respectively however the likelihood is low, as the old code using oracledb was working well. > I'm sure this is the case. You should use cursor.connection.commit() for commiting, not the other connection object! Or put an "assert conn == cursor.commit" somewhere... GThomas |
From: Wong W. Meng-R. <r3...@fr...> - 2011-10-09 11:42:27
|
Hello there, I continue to work on my application migration from python 1.5.2 to 2.7.1, from using oracledb to cx_Oracle in a python RMI framework. I am troubleshooting this issue whereby my API is updating userLastName of a given userId. I am doing cursor.execute("update......") first then connection.commit(). However, the data in the database doesn't seem changed, which means the "commit" did not get through. There is no error generated when ".commit()" is executed though. I am thinking my API might be using different connection objects to do the cursor.execute() and connection.commit(), respectively however the likelihood is low, as the old code using oracledb was working well. Does anyone has any idea how this can happen? Source code..... def _processDB( self, conn_type, conn, cursor, db_type, db_msg ): """Internal method to execute the database transaction given.""" reply_error = None try: print ">>>> _processDB : conn_type=%s, db_type=%s, db_msg=%s"%(conn_type, db_type, db_msg) if db_type == STMT_EXEC: msg, arg = db_msg if arg: reply_value = cursor.execute( msg, arg ) else: reply_value = cursor.execute( msg ) if reply_value == None: # none-select statement if conn_type == GENERAL_CONN: conn.commit() else: reply_value = cursor.fetchall() elif db_type == STMT_EXECL: msg, arg = db_msg if arg: reply_value = cursor.execute( msg, arg ) else: reply_value = cursor.execute( msg ) if reply_value == None: # select statement reply_value = cursor.fetchall() # get description desc_list = cursor.description desc = [] for i in desc_list: desc.append( i[0] ) reply_value.insert( 0, tuple(desc) ) else: if conn_type == GENERAL_CONN: conn.commit() elif db_type == STMT_PROC: reply_value = conn.callproc( db_msg ) elif db_type == STMT_COMMIT: print "Hello world" reply_value = conn.commit() elif db_type == STMT_ROLLBACK: reply_value = conn.rollback() print ">>>> _processDB : reply_value = %s"%(reply_value,) Debug Printout >>>> _processDB : conn_type=1, db_type=exec, db_msg=('select sysdate from sys.dual', ()) >>>> _processDB : reply_value = [(datetime.datetime(2011, 10, 9, 19, 25, 39),)] >>>> _processDB : conn_type=1, db_type=exec, db_msg=("select 1 from USERS where USER_ID = 'ftcs' and ROWNUM = 1", ()) >>>> _processDB : reply_value = [(1,)] >>>> _processDB : conn_type=1, db_type=exec, db_msg=('update USERS set USER_MODIFY_USER = :2, USER_MODIFY_DATE = :3, USER_FIRST_NAME = :4 where USER_ID = :1', ['ftcs', 'ftcs', datetime.datetime(2011, 10, 9, 19, 25, 39), 'Steven II']) >>>> _processDB : reply_value = None >>>> _processDB : conn_type=1, db_type=commit, db_msg=commit Hello world >>>> _processDB : reply_value = None Regards, Wah Meng Genesis Wafermap Support Ticket: To report a problem: http://dyno.freescale.net/Question/QuestionMain3.asp?location=zmy02&category=&tickettype=6820 To request a service: http://dyno.freescale.net/Question/Questionmain3.asp?location=74&category=2&tickettype=6819 Or if it is related to EWM or DSA: http://dyno.freescale.net/Question/Questionmain3.asp?location=ZMY02&tickettype=6539 |
From: Robert L. <rlu...@pi...> - 2011-10-09 11:26:58
|
Check out the Oracle manual Oracle Database Globalization Support Guide http://download.oracle.com/docs/cd/B19306_01/server.102/b14225/toc.htm Also, the manual "Oracle Database SQL Reference" http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/sql_elements0 01.htm#i45694 For performance reasons, Oracle recommends that you use the NLS_LENGTH_SEMANTICS parameter to set length semantics and that you use the BYTE and CHAR qualifiers only when necessary to override the parameter. -----Original Message----- From: cx-...@li... [mailto:cx-...@li...] Sent: Sunday, October 09, 2011 2:51 AM To: cx-...@li... Subject: cx-oracle-users Digest, Vol 64, Issue 2 Send cx-oracle-users mailing list submissions to cx-...@li... To subscribe or unsubscribe via the World Wide Web, visit https://lists.sourceforge.net/lists/listinfo/cx-oracle-users or, via email, send a message with subject or body 'help' to cx-...@li... You can reach the person managing the list at cx-...@li... When replying, please edit your Subject line so it is more specific than "Re: Contents of cx-oracle-users digest..." Today's Topics: 1. Re: Extracting data in Native Language: Error UnicodeEncodeError (Chris Gould) 2. Re: ORA-24550: signal received (Wong Wah Meng-R32813) ---------------------------------------------------------------------- Message: 1 Date: Thu, 6 Oct 2011 12:43:52 +0100 From: Chris Gould <chr...@to...> Subject: Re: [cx-oracle-users] Extracting data in Native Language: Error UnicodeEncodeError To: cx-...@li... Message-ID: <CA+...@ma...> Content-Type: text/plain; charset="utf-8" Just for reference, if you've using Oracle 10 or later you don't need to use NVARCHAR2 to store multi-byte characters. You can use VARCHAR2 (x CHAR) instead. The "x" here limits the field to a certain number of characters, not bytes. The default for VARCHAR2 is that the length specified is bytes unless you specify the CHAR qualifier. However, you can change this at system-level by setting NLS_LENGTH_SEMANTICS to CHAR. That way, if you declare a field as VARCHAR2(10) say, it will default to being 10 CHAR, not 10 BYTE. Even if you've already set up some VARCHAR2 fields, you can easily change the definitions to switch them all to CHAR. Below is a script to do this which I've used myself on databases. The nice thing about doing this is you can then carry on defining fields in future as VARCHAR2(10) say, and know that it'll hold 10 characters, regardless of how many bytes each character is, and you don't need to bother with NVARCHAR at all. I've used this approach on several systems and I never give any thought these days to what characters are being stored. Note - if you're using partitioning and have already got partition key columns which are VARCHAR2, trying to change from BYTE to CHAR will give an exception. The script picks this up and reports it. -- -- this is to change dictionary definitions for existing cols from BYTE to CHAR -- The database should have already had NLS_LENGTH_SEMANTICS = CHAR set -- This has to be run in each application schema that has tables. (not in any Oracle schemas like SYS or SYSTEM) -- ORA-14060 - cannot change length of partitioning column. -- So this needs to be done before any tables created where partitioning is on an affected (varchar2 or char) col alter session set NLS_LENGTH_SEMANTICS = CHAR; declare v_stmt varchar2(1000); PARTITIONING_COLUMN EXCEPTION; pragma exception_init(PARTITIONING_COLUMN,-14060); begin dbms_output.enable(NULL); for r1 in (select table_name ,column_name ,data_type ,data_length ,char_length from USER_TAB_COLUMNS where column_id is not null /* excludes oracle-generated cols for func-based indexes */ and data_type in ('VARCHAR2','CHAR') and char_used = 'B' /* defined as byte length */ order by table_name asc,column_id asc) loop begin v_stmt := 'alter table '||r1.table_name||' modify '||r1.column_name||' '||r1.data_type||'('||r1.char_length||')'; execute immediate v_stmt; dbms_output.put_line(substr(v_stmt,1,250)); exception when PARTITIONING_COLUMN then dbms_output.put_line('+++ '||r1.table_name||'.'||r1.column_name||' is partitioning col and cannot be changed'); when others then NULL; end; end loop; end; / On 6 October 2011 08:50, Wong Wah Meng-R32813 <r3...@fr...> wrote: > Hello there,**** > > ** ** > > I am migrating my application from python 1.5.2 to 2.7.1, from using > oracledb to cx_oracle. **** > > ** ** > > My database is setup with AL32UTF8 characterset, in order to support > Chinese character entry. **** > > ** ** > > I am in testing stage now. I have never used nVarchar type before as my > column type but now I am using it so that I can be sure exactly the number > of bytes the field can store is predictable regardless it is plain English > or Unicode characters.**** > > ** ** > > When I do insert and update, I do not explicitly pass in some prefix (u for > unicode) onto the data in my SQL statement. However, when I do a SQL query, > the return list tuple from python cx_Oracle seems to attach a prefix u in > front of the data with column type nVarchar. When I want to extract or parse > the data, I encountered an error (expectedly). I am new to this can anyone > tell what I should look at in order to parse native language characters > successfully after getting the raw reply from a cx_Oracle?s query?**** > > ** ** > > E.g. **** > > ** ** > > >>> reply=a.execute("select * from TEST271")**** > > >>> reply**** > > [('\xb2\xe2\xca\xd4', u'\u6d4b\u8bd5')]**** > > >>> for (text1, text2) in reply:**** > > ... print text1, text2**** > > ... **** > > ???? Traceback (most recent call last):**** > > File "<stdin>", line 2, in <module>**** > > File > "/home/r32813/genesis/GEN_DEV_271/Enablers/Python/lib/python2.7/encodings/hp _roman8.py", > line 17, in encode**** > > return codecs.charmap_encode(input,errors,encoding_map)**** > > UnicodeEncodeError: 'charmap' codec can't encode characters in position > 0-1: character maps to <undefined>**** > > >>> **** > > ** ** > > SQL> desc test271**** > > Name Null? Type**** > > ----------------------------------------- -------- > ----------------------------**** > > TEXT1 VARCHAR2(16)**** > > TEXT2 NVARCHAR2(16)**** > > **** > > ** ** > > Regards,**** > > Wah Meng**** > > ** ** > > > -------------------------------------------------------------------------- ---- > All the data continuously generated in your IT infrastructure contains a > definitive record of customers, application performance, security > threats, fraudulent activity and more. Splunk takes this data and makes > sense of it. Business sense. IT sense. Common sense. > http://p.sf.net/sfu/splunk-d2dcopy1 > _______________________________________________ > cx-oracle-users mailing list > cx-...@li... > https://lists.sourceforge.net/lists/listinfo/cx-oracle-users > > -------------- next part -------------- An HTML attachment was scrubbed... ------------------------------ Message: 2 Date: Sun, 9 Oct 2011 07:50:58 +0000 From: Wong Wah Meng-R32813 <r3...@fr...> Subject: Re: [cx-oracle-users] ORA-24550: signal received To: "cx-...@li..." <cx-...@li...> Message-ID: <02E...@03...> Content-Type: text/plain; charset="us-ascii" Hello Anthony, I am not sure what happened when I first plug in conn = cx_Oracle.connect(<connection string>, threaded=True) it didn't seem to work, however when I tried again it worked. It works until now, even though I have removed the "threaded=True" from the connect() argument list in my source code. I have stopped and started my process multiple times and it still works without failure (no more signal failed error), when threaded=True is omitted. Though I have not seen any difference now by including or omitting it from the argument list, I have decided to include it into my source code. I need to revisit this if on another day bad luck strike me that it gives me that error again. :p Thanks a lot! Regards, Wah Meng -----Original Message----- From: Anthony Tuininga [mailto:ant...@gm...] Sent: Wednesday, October 05, 2011 12:29 PM To: cx-...@li... Subject: Re: [cx-oracle-users] ORA-24550: signal received Hi, I mean threaded = True when creating the connection to the database. Anthony On Tue, Oct 4, 2011 at 9:48 PM, Wong Wah Meng-R32813 <r3...@fr...> wrote: > Hello Anthony, > > Do you mean I can pass in threaded=true when creating the connection to database (cx_Oracle.connect method)? Or do you mean the --enable-thread setting during the build of the python executable? > > Regards, > Wah Meng > > -----Original Message----- > From: Anthony Tuininga [mailto:ant...@gm...] > Sent: Tuesday, October 04, 2011 9:58 PM > To: cx-...@li... > Subject: Re: [cx-oracle-users] ORA-24550: signal received > > Hi, > > If you have multiple threads, make sure that you specify threaded = > True when creating the connection or you will run into difficulties. > The reason this is not default is that there is a performance penalty > that is unnecessary when running single threaded -- which is the most > common mode anyway. > > Hope that helps. > > Anthony > > On Tue, Oct 4, 2011 at 4:27 AM, Wong Wah Meng-R32813 > <r3...@fr...> wrote: >> Hello guys, >> >> >> >> Has anyone seen this befote? >> >> >> >> I am migrating my RMI application from python 1.5.2 (oracledb) to 2.7.1 >> (cx_Oracle). When I start up my DbAccessMgr, previously utilizing oracledb >> to connect to database, I encountered below error. I haven't traced down to >> exactly which code is producing this error however it seems that this is >> generated after I spawn off 4 parallel threads instance for the database >> connection from my application. >> >> >> >> The funnier thing is I am able to launch my DbAccessMgr successfully without >> this error after every 2 failures. My DBA told me this should be application >> specific unless I can show otherwise. Appreciate any input out there. >> Thanks! >> >> >> >> (PS: My platform in HP-UX11.31 and cx_Oracle was compiled against Oracle >> 11.1 library using HP-UX C Compiler) >> >> >> >> ORA-24550: signal received: [si_signo=11] [si_errno=0] [si_code=2] >> [si_addr=0000000000000000] >> >> >> >> sendsig: useracc failed. 0x9fffffff5feb6200 0x00000000005000 >> >> >> >> Pid 8162 was killed due to failure in writing the signal context - possible >> stack overflow. >> >> >> >> Regards, >> >> Wah Meng >> >> >> >> ------------------------------------------------------------------------- ----- >> All the data continuously generated in your IT infrastructure contains a >> definitive record of customers, application performance, security >> threats, fraudulent activity and more. Splunk takes this data and makes >> sense of it. Business sense. IT sense. Common sense. >> http://p.sf.net/sfu/splunk-d2dcopy1 >> _______________________________________________ >> cx-oracle-users mailing list >> cx-...@li... >> https://lists.sourceforge.net/lists/listinfo/cx-oracle-users >> >> > > -------------------------------------------------------------------------- ---- > All the data continuously generated in your IT infrastructure contains a > definitive record of customers, application performance, security > threats, fraudulent activity and more. Splunk takes this data and makes > sense of it. Business sense. IT sense. Common sense. > http://p.sf.net/sfu/splunk-d2dcopy1 > _______________________________________________ > cx-oracle-users mailing list > cx-...@li... > https://lists.sourceforge.net/lists/listinfo/cx-oracle-users > > > > -------------------------------------------------------------------------- ---- > All the data continuously generated in your IT infrastructure contains a > definitive record of customers, application performance, security > threats, fraudulent activity and more. Splunk takes this data and makes > sense of it. Business sense. IT sense. Common sense. > http://p.sf.net/sfu/splunk-d2dcopy1 > _______________________________________________ > cx-oracle-users mailing list > cx-...@li... > https://lists.sourceforge.net/lists/listinfo/cx-oracle-users > ---------------------------------------------------------------------------- -- All the data continuously generated in your IT infrastructure contains a definitive record of customers, application performance, security threats, fraudulent activity and more. Splunk takes this data and makes sense of it. Business sense. IT sense. Common sense. http://p.sf.net/sfu/splunk-d2dcopy1 _______________________________________________ cx-oracle-users mailing list cx-...@li... https://lists.sourceforge.net/lists/listinfo/cx-oracle-users ------------------------------ ---------------------------------------------------------------------------- -- All of the data generated in your IT infrastructure is seriously valuable. Why? It contains a definitive record of application performance, security threats, fraudulent activity, and more. Splunk takes this data and makes sense of it. IT sense. And common sense. http://p.sf.net/sfu/splunk-d2dcopy2 ------------------------------ _______________________________________________ cx-oracle-users mailing list cx-...@li... https://lists.sourceforge.net/lists/listinfo/cx-oracle-users End of cx-oracle-users Digest, Vol 64, Issue 2 ********************************************** |
From: Wong W. Meng-R. <r3...@fr...> - 2011-10-09 07:51:09
|
Hello Anthony, I am not sure what happened when I first plug in conn = cx_Oracle.connect(<connection string>, threaded=True) it didn't seem to work, however when I tried again it worked. It works until now, even though I have removed the "threaded=True" from the connect() argument list in my source code. I have stopped and started my process multiple times and it still works without failure (no more signal failed error), when threaded=True is omitted. Though I have not seen any difference now by including or omitting it from the argument list, I have decided to include it into my source code. I need to revisit this if on another day bad luck strike me that it gives me that error again. :p Thanks a lot! Regards, Wah Meng -----Original Message----- From: Anthony Tuininga [mailto:ant...@gm...] Sent: Wednesday, October 05, 2011 12:29 PM To: cx-...@li... Subject: Re: [cx-oracle-users] ORA-24550: signal received Hi, I mean threaded = True when creating the connection to the database. Anthony On Tue, Oct 4, 2011 at 9:48 PM, Wong Wah Meng-R32813 <r3...@fr...> wrote: > Hello Anthony, > > Do you mean I can pass in threaded=true when creating the connection to database (cx_Oracle.connect method)? Or do you mean the --enable-thread setting during the build of the python executable? > > Regards, > Wah Meng > > -----Original Message----- > From: Anthony Tuininga [mailto:ant...@gm...] > Sent: Tuesday, October 04, 2011 9:58 PM > To: cx-...@li... > Subject: Re: [cx-oracle-users] ORA-24550: signal received > > Hi, > > If you have multiple threads, make sure that you specify threaded = > True when creating the connection or you will run into difficulties. > The reason this is not default is that there is a performance penalty > that is unnecessary when running single threaded -- which is the most > common mode anyway. > > Hope that helps. > > Anthony > > On Tue, Oct 4, 2011 at 4:27 AM, Wong Wah Meng-R32813 > <r3...@fr...> wrote: >> Hello guys, >> >> >> >> Has anyone seen this befote? >> >> >> >> I am migrating my RMI application from python 1.5.2 (oracledb) to 2.7.1 >> (cx_Oracle). When I start up my DbAccessMgr, previously utilizing oracledb >> to connect to database, I encountered below error. I haven't traced down to >> exactly which code is producing this error however it seems that this is >> generated after I spawn off 4 parallel threads instance for the database >> connection from my application. >> >> >> >> The funnier thing is I am able to launch my DbAccessMgr successfully without >> this error after every 2 failures. My DBA told me this should be application >> specific unless I can show otherwise. Appreciate any input out there. >> Thanks! >> >> >> >> (PS: My platform in HP-UX11.31 and cx_Oracle was compiled against Oracle >> 11.1 library using HP-UX C Compiler) >> >> >> >> ORA-24550: signal received: [si_signo=11] [si_errno=0] [si_code=2] >> [si_addr=0000000000000000] >> >> >> >> sendsig: useracc failed. 0x9fffffff5feb6200 0x00000000005000 >> >> >> >> Pid 8162 was killed due to failure in writing the signal context - possible >> stack overflow. >> >> >> >> Regards, >> >> Wah Meng >> >> >> >> ------------------------------------------------------------------------------ >> All the data continuously generated in your IT infrastructure contains a >> definitive record of customers, application performance, security >> threats, fraudulent activity and more. Splunk takes this data and makes >> sense of it. Business sense. IT sense. Common sense. >> http://p.sf.net/sfu/splunk-d2dcopy1 >> _______________________________________________ >> cx-oracle-users mailing list >> cx-...@li... >> https://lists.sourceforge.net/lists/listinfo/cx-oracle-users >> >> > > ------------------------------------------------------------------------------ > All the data continuously generated in your IT infrastructure contains a > definitive record of customers, application performance, security > threats, fraudulent activity and more. Splunk takes this data and makes > sense of it. Business sense. IT sense. Common sense. > http://p.sf.net/sfu/splunk-d2dcopy1 > _______________________________________________ > cx-oracle-users mailing list > cx-...@li... > https://lists.sourceforge.net/lists/listinfo/cx-oracle-users > > > > ------------------------------------------------------------------------------ > All the data continuously generated in your IT infrastructure contains a > definitive record of customers, application performance, security > threats, fraudulent activity and more. Splunk takes this data and makes > sense of it. Business sense. IT sense. Common sense. > http://p.sf.net/sfu/splunk-d2dcopy1 > _______________________________________________ > cx-oracle-users mailing list > cx-...@li... > https://lists.sourceforge.net/lists/listinfo/cx-oracle-users > ------------------------------------------------------------------------------ All the data continuously generated in your IT infrastructure contains a definitive record of customers, application performance, security threats, fraudulent activity and more. Splunk takes this data and makes sense of it. Business sense. IT sense. Common sense. http://p.sf.net/sfu/splunk-d2dcopy1 _______________________________________________ cx-oracle-users mailing list cx-...@li... https://lists.sourceforge.net/lists/listinfo/cx-oracle-users |
From: Chris G. <chr...@to...> - 2011-10-06 11:44:19
|
Just for reference, if you've using Oracle 10 or later you don't need to use NVARCHAR2 to store multi-byte characters. You can use VARCHAR2 (x CHAR) instead. The "x" here limits the field to a certain number of characters, not bytes. The default for VARCHAR2 is that the length specified is bytes unless you specify the CHAR qualifier. However, you can change this at system-level by setting NLS_LENGTH_SEMANTICS to CHAR. That way, if you declare a field as VARCHAR2(10) say, it will default to being 10 CHAR, not 10 BYTE. Even if you've already set up some VARCHAR2 fields, you can easily change the definitions to switch them all to CHAR. Below is a script to do this which I've used myself on databases. The nice thing about doing this is you can then carry on defining fields in future as VARCHAR2(10) say, and know that it'll hold 10 characters, regardless of how many bytes each character is, and you don't need to bother with NVARCHAR at all. I've used this approach on several systems and I never give any thought these days to what characters are being stored. Note - if you're using partitioning and have already got partition key columns which are VARCHAR2, trying to change from BYTE to CHAR will give an exception. The script picks this up and reports it. -- -- this is to change dictionary definitions for existing cols from BYTE to CHAR -- The database should have already had NLS_LENGTH_SEMANTICS = CHAR set -- This has to be run in each application schema that has tables. (not in any Oracle schemas like SYS or SYSTEM) -- ORA-14060 - cannot change length of partitioning column. -- So this needs to be done before any tables created where partitioning is on an affected (varchar2 or char) col alter session set NLS_LENGTH_SEMANTICS = CHAR; declare v_stmt varchar2(1000); PARTITIONING_COLUMN EXCEPTION; pragma exception_init(PARTITIONING_COLUMN,-14060); begin dbms_output.enable(NULL); for r1 in (select table_name ,column_name ,data_type ,data_length ,char_length from USER_TAB_COLUMNS where column_id is not null /* excludes oracle-generated cols for func-based indexes */ and data_type in ('VARCHAR2','CHAR') and char_used = 'B' /* defined as byte length */ order by table_name asc,column_id asc) loop begin v_stmt := 'alter table '||r1.table_name||' modify '||r1.column_name||' '||r1.data_type||'('||r1.char_length||')'; execute immediate v_stmt; dbms_output.put_line(substr(v_stmt,1,250)); exception when PARTITIONING_COLUMN then dbms_output.put_line('+++ '||r1.table_name||'.'||r1.column_name||' is partitioning col and cannot be changed'); when others then NULL; end; end loop; end; / On 6 October 2011 08:50, Wong Wah Meng-R32813 <r3...@fr...> wrote: > Hello there,**** > > ** ** > > I am migrating my application from python 1.5.2 to 2.7.1, from using > oracledb to cx_oracle. **** > > ** ** > > My database is setup with AL32UTF8 characterset, in order to support > Chinese character entry. **** > > ** ** > > I am in testing stage now. I have never used nVarchar type before as my > column type but now I am using it so that I can be sure exactly the number > of bytes the field can store is predictable regardless it is plain English > or Unicode characters.**** > > ** ** > > When I do insert and update, I do not explicitly pass in some prefix (u for > unicode) onto the data in my SQL statement. However, when I do a SQL query, > the return list tuple from python cx_Oracle seems to attach a prefix u in > front of the data with column type nVarchar. When I want to extract or parse > the data, I encountered an error (expectedly). I am new to this can anyone > tell what I should look at in order to parse native language characters > successfully after getting the raw reply from a cx_Oracle’s query?**** > > ** ** > > E.g. **** > > ** ** > > >>> reply=a.execute("select * from TEST271")**** > > >>> reply**** > > [('\xb2\xe2\xca\xd4', u'\u6d4b\u8bd5')]**** > > >>> for (text1, text2) in reply:**** > > ... print text1, text2**** > > ... **** > > ýãòå Traceback (most recent call last):**** > > File "<stdin>", line 2, in <module>**** > > File > "/home/r32813/genesis/GEN_DEV_271/Enablers/Python/lib/python2.7/encodings/hp_roman8.py", > line 17, in encode**** > > return codecs.charmap_encode(input,errors,encoding_map)**** > > UnicodeEncodeError: 'charmap' codec can't encode characters in position > 0-1: character maps to <undefined>**** > > >>> **** > > ** ** > > SQL> desc test271**** > > Name Null? Type**** > > ----------------------------------------- -------- > ----------------------------**** > > TEXT1 VARCHAR2(16)**** > > TEXT2 NVARCHAR2(16)**** > > **** > > ** ** > > Regards,**** > > Wah Meng**** > > ** ** > > > ------------------------------------------------------------------------------ > All the data continuously generated in your IT infrastructure contains a > definitive record of customers, application performance, security > threats, fraudulent activity and more. Splunk takes this data and makes > sense of it. Business sense. IT sense. Common sense. > http://p.sf.net/sfu/splunk-d2dcopy1 > _______________________________________________ > cx-oracle-users mailing list > cx-...@li... > https://lists.sourceforge.net/lists/listinfo/cx-oracle-users > > |
From: Wong W. Meng-R. <r3...@fr...> - 2011-10-06 07:50:48
|
Hello there, I am migrating my application from python 1.5.2 to 2.7.1, from using oracledb to cx_oracle. My database is setup with AL32UTF8 characterset, in order to support Chinese character entry. I am in testing stage now. I have never used nVarchar type before as my column type but now I am using it so that I can be sure exactly the number of bytes the field can store is predictable regardless it is plain English or Unicode characters. When I do insert and update, I do not explicitly pass in some prefix (u for unicode) onto the data in my SQL statement. However, when I do a SQL query, the return list tuple from python cx_Oracle seems to attach a prefix u in front of the data with column type nVarchar. When I want to extract or parse the data, I encountered an error (expectedly). I am new to this can anyone tell what I should look at in order to parse native language characters successfully after getting the raw reply from a cx_Oracle's query? E.g. >>> reply=a.execute("select * from TEST271") >>> reply [('\xb2\xe2\xca\xd4', u'\u6d4b\u8bd5')] >>> for (text1, text2) in reply: ... print text1, text2 ... ýãòå Traceback (most recent call last): File "<stdin>", line 2, in <module> File "/home/r32813/genesis/GEN_DEV_271/Enablers/Python/lib/python2.7/encodings/hp_roman8.py", line 17, in encode return codecs.charmap_encode(input,errors,encoding_map) UnicodeEncodeError: 'charmap' codec can't encode characters in position 0-1: character maps to <undefined> >>> SQL> desc test271 Name Null? Type ----------------------------------------- -------- ---------------------------- TEXT1 VARCHAR2(16) TEXT2 NVARCHAR2(16) Regards, Wah Meng |
From: Anthony T. <ant...@gm...> - 2011-10-05 04:29:17
|
Hi, I mean threaded = True when creating the connection to the database. Anthony On Tue, Oct 4, 2011 at 9:48 PM, Wong Wah Meng-R32813 <r3...@fr...> wrote: > Hello Anthony, > > Do you mean I can pass in threaded=true when creating the connection to database (cx_Oracle.connect method)? Or do you mean the --enable-thread setting during the build of the python executable? > > Regards, > Wah Meng > > -----Original Message----- > From: Anthony Tuininga [mailto:ant...@gm...] > Sent: Tuesday, October 04, 2011 9:58 PM > To: cx-...@li... > Subject: Re: [cx-oracle-users] ORA-24550: signal received > > Hi, > > If you have multiple threads, make sure that you specify threaded = > True when creating the connection or you will run into difficulties. > The reason this is not default is that there is a performance penalty > that is unnecessary when running single threaded -- which is the most > common mode anyway. > > Hope that helps. > > Anthony > > On Tue, Oct 4, 2011 at 4:27 AM, Wong Wah Meng-R32813 > <r3...@fr...> wrote: >> Hello guys, >> >> >> >> Has anyone seen this befote? >> >> >> >> I am migrating my RMI application from python 1.5.2 (oracledb) to 2.7.1 >> (cx_Oracle). When I start up my DbAccessMgr, previously utilizing oracledb >> to connect to database, I encountered below error. I haven't traced down to >> exactly which code is producing this error however it seems that this is >> generated after I spawn off 4 parallel threads instance for the database >> connection from my application. >> >> >> >> The funnier thing is I am able to launch my DbAccessMgr successfully without >> this error after every 2 failures. My DBA told me this should be application >> specific unless I can show otherwise. Appreciate any input out there. >> Thanks! >> >> >> >> (PS: My platform in HP-UX11.31 and cx_Oracle was compiled against Oracle >> 11.1 library using HP-UX C Compiler) >> >> >> >> ORA-24550: signal received: [si_signo=11] [si_errno=0] [si_code=2] >> [si_addr=0000000000000000] >> >> >> >> sendsig: useracc failed. 0x9fffffff5feb6200 0x00000000005000 >> >> >> >> Pid 8162 was killed due to failure in writing the signal context - possible >> stack overflow. >> >> >> >> Regards, >> >> Wah Meng >> >> >> >> ------------------------------------------------------------------------------ >> All the data continuously generated in your IT infrastructure contains a >> definitive record of customers, application performance, security >> threats, fraudulent activity and more. Splunk takes this data and makes >> sense of it. Business sense. IT sense. Common sense. >> http://p.sf.net/sfu/splunk-d2dcopy1 >> _______________________________________________ >> cx-oracle-users mailing list >> cx-...@li... >> https://lists.sourceforge.net/lists/listinfo/cx-oracle-users >> >> > > ------------------------------------------------------------------------------ > All the data continuously generated in your IT infrastructure contains a > definitive record of customers, application performance, security > threats, fraudulent activity and more. Splunk takes this data and makes > sense of it. Business sense. IT sense. Common sense. > http://p.sf.net/sfu/splunk-d2dcopy1 > _______________________________________________ > cx-oracle-users mailing list > cx-...@li... > https://lists.sourceforge.net/lists/listinfo/cx-oracle-users > > > > ------------------------------------------------------------------------------ > All the data continuously generated in your IT infrastructure contains a > definitive record of customers, application performance, security > threats, fraudulent activity and more. Splunk takes this data and makes > sense of it. Business sense. IT sense. Common sense. > http://p.sf.net/sfu/splunk-d2dcopy1 > _______________________________________________ > cx-oracle-users mailing list > cx-...@li... > https://lists.sourceforge.net/lists/listinfo/cx-oracle-users > |
From: Wong W. Meng-R. <r3...@fr...> - 2011-10-05 03:48:22
|
Hello Anthony, Do you mean I can pass in threaded=true when creating the connection to database (cx_Oracle.connect method)? Or do you mean the --enable-thread setting during the build of the python executable? Regards, Wah Meng -----Original Message----- From: Anthony Tuininga [mailto:ant...@gm...] Sent: Tuesday, October 04, 2011 9:58 PM To: cx-...@li... Subject: Re: [cx-oracle-users] ORA-24550: signal received Hi, If you have multiple threads, make sure that you specify threaded = True when creating the connection or you will run into difficulties. The reason this is not default is that there is a performance penalty that is unnecessary when running single threaded -- which is the most common mode anyway. Hope that helps. Anthony On Tue, Oct 4, 2011 at 4:27 AM, Wong Wah Meng-R32813 <r3...@fr...> wrote: > Hello guys, > > > > Has anyone seen this befote? > > > > I am migrating my RMI application from python 1.5.2 (oracledb) to 2.7.1 > (cx_Oracle). When I start up my DbAccessMgr, previously utilizing oracledb > to connect to database, I encountered below error. I haven't traced down to > exactly which code is producing this error however it seems that this is > generated after I spawn off 4 parallel threads instance for the database > connection from my application. > > > > The funnier thing is I am able to launch my DbAccessMgr successfully without > this error after every 2 failures. My DBA told me this should be application > specific unless I can show otherwise. Appreciate any input out there. > Thanks! > > > > (PS: My platform in HP-UX11.31 and cx_Oracle was compiled against Oracle > 11.1 library using HP-UX C Compiler) > > > > ORA-24550: signal received: [si_signo=11] [si_errno=0] [si_code=2] > [si_addr=0000000000000000] > > > > sendsig: useracc failed. 0x9fffffff5feb6200 0x00000000005000 > > > > Pid 8162 was killed due to failure in writing the signal context - possible > stack overflow. > > > > Regards, > > Wah Meng > > > > ------------------------------------------------------------------------------ > All the data continuously generated in your IT infrastructure contains a > definitive record of customers, application performance, security > threats, fraudulent activity and more. Splunk takes this data and makes > sense of it. Business sense. IT sense. Common sense. > http://p.sf.net/sfu/splunk-d2dcopy1 > _______________________________________________ > cx-oracle-users mailing list > cx-...@li... > https://lists.sourceforge.net/lists/listinfo/cx-oracle-users > > ------------------------------------------------------------------------------ All the data continuously generated in your IT infrastructure contains a definitive record of customers, application performance, security threats, fraudulent activity and more. Splunk takes this data and makes sense of it. Business sense. IT sense. Common sense. http://p.sf.net/sfu/splunk-d2dcopy1 _______________________________________________ cx-oracle-users mailing list cx-...@li... https://lists.sourceforge.net/lists/listinfo/cx-oracle-users |
From: Anthony T. <ant...@gm...> - 2011-10-04 13:58:02
|
Hi, If you have multiple threads, make sure that you specify threaded = True when creating the connection or you will run into difficulties. The reason this is not default is that there is a performance penalty that is unnecessary when running single threaded -- which is the most common mode anyway. Hope that helps. Anthony On Tue, Oct 4, 2011 at 4:27 AM, Wong Wah Meng-R32813 <r3...@fr...> wrote: > Hello guys, > > > > Has anyone seen this befote? > > > > I am migrating my RMI application from python 1.5.2 (oracledb) to 2.7.1 > (cx_Oracle). When I start up my DbAccessMgr, previously utilizing oracledb > to connect to database, I encountered below error. I haven’t traced down to > exactly which code is producing this error however it seems that this is > generated after I spawn off 4 parallel threads instance for the database > connection from my application. > > > > The funnier thing is I am able to launch my DbAccessMgr successfully without > this error after every 2 failures. My DBA told me this should be application > specific unless I can show otherwise. Appreciate any input out there. > Thanks! > > > > (PS: My platform in HP-UX11.31 and cx_Oracle was compiled against Oracle > 11.1 library using HP-UX C Compiler) > > > > ORA-24550: signal received: [si_signo=11] [si_errno=0] [si_code=2] > [si_addr=0000000000000000] > > > > sendsig: useracc failed. 0x9fffffff5feb6200 0x00000000005000 > > > > Pid 8162 was killed due to failure in writing the signal context - possible > stack overflow. > > > > Regards, > > Wah Meng > > > > ------------------------------------------------------------------------------ > All the data continuously generated in your IT infrastructure contains a > definitive record of customers, application performance, security > threats, fraudulent activity and more. Splunk takes this data and makes > sense of it. Business sense. IT sense. Common sense. > http://p.sf.net/sfu/splunk-d2dcopy1 > _______________________________________________ > cx-oracle-users mailing list > cx-...@li... > https://lists.sourceforge.net/lists/listinfo/cx-oracle-users > > |
From: Wong W. Meng-R. <r3...@fr...> - 2011-10-04 10:27:28
|
Hello guys, Has anyone seen this befote? I am migrating my RMI application from python 1.5.2 (oracledb) to 2.7.1 (cx_Oracle). When I start up my DbAccessMgr, previously utilizing oracledb to connect to database, I encountered below error. I haven't traced down to exactly which code is producing this error however it seems that this is generated after I spawn off 4 parallel threads instance for the database connection from my application. The funnier thing is I am able to launch my DbAccessMgr successfully without this error after every 2 failures. My DBA told me this should be application specific unless I can show otherwise. Appreciate any input out there. Thanks! (PS: My platform in HP-UX11.31 and cx_Oracle was compiled against Oracle 11.1 library using HP-UX C Compiler) ORA-24550: signal received: [si_signo=11] [si_errno=0] [si_code=2] [si_addr=0000000000000000] sendsig: useracc failed. 0x9fffffff5feb6200 0x00000000005000 Pid 8162 was killed due to failure in writing the signal context - possible stack overflow. Regards, Wah Meng |
From: Mike E. <Mik...@eu...> - 2011-09-30 14:15:04
|
With the new update Django is working fine here. Thanks! Mike. -----Original Message----- From: Anthony Tuininga [mailto:ant...@gm...] Sent: Wednesday, September 28, 2011 5:48 AM To: cx-...@li... Subject: Re: [cx-oracle-users] ORA-03127 All, I have checked in a change that uses OCI_UTF16ID for NCLOBs which seems to resolve the problem. I'd appreciate anyone who has noticed this problem checking it out and letting me know if this causes a problem anywhere else. I have run the test suite without any problems so not too likely but others testing would be helpful before I make a new release. I'd like to make the new release this week yet if possible. If you do get a chance to test, please let me know. Thanks. Anthony On Mon, Sep 5, 2011 at 7:44 AM, Anthony Tuininga <ant...@gm...> wrote: > Hi, > > Most of the errors you are noticing below are due to the fact that the > encoding you are using does not support the characters included in the > test suite. You will need to use an encoding that does support them -- > like UTF8. > > export NLS_LANG=.NTF8 > > is what I happen to use. > > In addition, I downloaded and installed 11.2.0.2 on my Linux box and > am now able to get the errors reported earlier -- so now I can look > into why this is happening and hopefully find a solution! Stay tuned. > :-) > > Anthony > > On Mon, Sep 5, 2011 at 3:51 AM, Mike Elson <Mik...@eu...> wrote: >> Hello Anthony, >> >> Thanks for looking into this. >> I ran the test suite and saw some Unicode related errors, see the relevant section pasted below. >> >> The client is Suse Linux, Python 2.7.2 cx_Oracle svn revision #359 (no modifications) and the >> database server parameters are: >> >> NLS_LANGUAGE AMERICAN >> NLS_TERRITORY AMERICA >> NLS_CURRENCY $ >> NLS_ISO_CURRENCY AMERICA >> NLS_NUMERIC_CHARACTERS ., >> NLS_CHARACTERSET WE8MSWIN1252 >> NLS_CALENDAR GREGORIAN >> NLS_DATE_FORMAT DD-MON-RR >> NLS_DATE_LANGUAGE AMERICAN >> NLS_SORT BINARY >> NLS_TIME_FORMAT HH.MI.SSXFF AM >> NLS_TIMESTAMP_FORMAT DD-MON-RR HH.MI.SSXFF AM >> NLS_TIME_TZ_FORMAT HH.MI.SSXFF AM TZR >> NLS_TIMESTAMP_TZ_FORMAT DD-MON-RR HH.MI.SSXFF AM TZR >> NLS_DUAL_CURRENCY $ >> NLS_COMP BINARY >> NLS_LENGTH_SEMANTICS BYTE >> NLS_NCHAR_CONV_EXCP FALSE >> NLS_NCHAR_CHARACTERSET UTF8 >> NLS_RDBMS_VERSION 11.2.0.2.0 >> >> Output from "python setup.py test": >> >> Running tests in UnicodeVar.py >> testBindDifferentVar (UnicodeVar.TestUnicodeVar) >> test binding a different variable on second execution ... FAIL >> testBindInOutSetInputSizesByType (UnicodeVar.TestUnicodeVar) >> test binding in/out with set input sizes defined (by type) ... ERROR >> testBindInOutUnicodeArrayByVar (UnicodeVar.TestUnicodeVar) >> test binding in/out a unicode array (with arrayvar) ... ERROR >> testBindInOutVarDirectSet (UnicodeVar.TestUnicodeVar) >> test binding in/out with cursor.var() method ... ERROR >> testBindNull (UnicodeVar.TestUnicodeVar) >> test binding in a null ... ok >> testBindOutSetInputSizesByType (UnicodeVar.TestUnicodeVar) >> test binding out with set input sizes defined (by type) ... FAIL >> testBindOutUnicodeArrayByVar (UnicodeVar.TestUnicodeVar) >> test binding out a unicode array (with arrayvar) ... FAIL >> testBindOutVar (UnicodeVar.TestUnicodeVar) >> test binding out with cursor.var() method ... FAIL >> testBindUnicode (UnicodeVar.TestUnicodeVar) >> test binding in a unicode ... ERROR >> testBindUnicodeAfterNumber (UnicodeVar.TestUnicodeVar) >> test binding in a unicode after setting input sizes to a number ... ERROR >> testBindUnicodeArrayBySizes (UnicodeVar.TestUnicodeVar) >> test binding in a unicode array (with setinputsizes) ... ERROR >> testBindUnicodeArrayByVar (UnicodeVar.TestUnicodeVar) >> test binding in a unicode array (with arrayvar) ... ERROR >> testBindUnicodeArrayDirect (UnicodeVar.TestUnicodeVar) >> test binding in a unicode array ... ERROR >> testCursorDescription (UnicodeVar.TestUnicodeVar) >> test cursor description is accurate ... FAIL >> testFetchAll (UnicodeVar.TestUnicodeVar) >> test that fetching all of the data returns the correct results ... FAIL >> testFetchMany (UnicodeVar.TestUnicodeVar) >> test that fetching data in chunks returns the correct results ... FAIL >> testFetchOne (UnicodeVar.TestUnicodeVar) >> test that fetching a single row returns the correct results ... FAIL >> testUnicodeLength (UnicodeVar.TestUnicodeVar) >> test value length ... ERROR >> testUnicodeMaximumReached (UnicodeVar.TestUnicodeVar) >> test that an error is raised when maximum unicode length exceeded ... ok >> >> ====================================================================== >> ERROR: testBindInOutSetInputSizesByType (UnicodeVar.TestUnicodeVar) >> test binding in/out with set input sizes defined (by type) >> ---------------------------------------------------------------------- >> Traceback (most recent call last): >> File "test/UnicodeVar.py", line 162, in testBindInOutSetInputSizesByType >> value = u"InVal \u3041") >> UnicodeEncodeError: 'ascii' codec can't encode character u'\u3041' in position 6: ordinal not in range(128) >> >> ====================================================================== >> ERROR: testBindInOutUnicodeArrayByVar (UnicodeVar.TestUnicodeVar) >> test binding in/out a unicode array (with arrayvar) >> ---------------------------------------------------------------------- >> Traceback (most recent call last): >> File "test/UnicodeVar.py", line 116, in testBindInOutUnicodeArrayByVar >> array.setvalue(0, originalData) >> UnicodeEncodeError: 'ascii' codec can't encode character u'\u3042' in position 8: ordinal not in range(128) >> >> ====================================================================== >> ERROR: testBindInOutVarDirectSet (UnicodeVar.TestUnicodeVar) >> test binding in/out with cursor.var() method >> ---------------------------------------------------------------------- >> Traceback (most recent call last): >> File "test/UnicodeVar.py", line 179, in testBindInOutVarDirectSet >> var.setvalue(0, u"InVal \u3041") >> UnicodeEncodeError: 'ascii' codec can't encode character u'\u3041' in position 6: ordinal not in range(128) >> >> ====================================================================== >> ERROR: testBindUnicode (UnicodeVar.TestUnicodeVar) >> test binding in a unicode >> ---------------------------------------------------------------------- >> Traceback (most recent call last): >> File "test/UnicodeVar.py", line 36, in testBindUnicode >> value = u"Unicode \u3042 5") >> UnicodeEncodeError: 'ascii' codec can't encode character u'\u3042' in position 8: ordinal not in range(128) >> >> ====================================================================== >> ERROR: testBindUnicodeAfterNumber (UnicodeVar.TestUnicodeVar) >> test binding in a unicode after setting input sizes to a number >> ---------------------------------------------------------------------- >> Traceback (most recent call last): >> File "test/UnicodeVar.py", line 56, in testBindUnicodeAfterNumber >> value = u"Unicode \u3042 6") >> UnicodeEncodeError: 'ascii' codec can't encode character u'\u3042' in position 8: ordinal not in range(128) >> >> ====================================================================== >> ERROR: testBindUnicodeArrayBySizes (UnicodeVar.TestUnicodeVar) >> test binding in a unicode array (with setinputsizes) >> ---------------------------------------------------------------------- >> Traceback (most recent call last): >> File "test/UnicodeVar.py", line 91, in testBindUnicodeArrayBySizes >> array = array) >> UnicodeEncodeError: 'ascii' codec can't encode character u'\u3042' in position 8: ordinal not in range(128) >> >> ====================================================================== >> ERROR: testBindUnicodeArrayByVar (UnicodeVar.TestUnicodeVar) >> test binding in a unicode array (with arrayvar) >> ---------------------------------------------------------------------- >> Traceback (most recent call last): >> File "test/UnicodeVar.py", line 98, in testBindUnicodeArrayByVar >> array.setvalue(0, [r[1] for r in self.rawData]) >> UnicodeEncodeError: 'ascii' codec can't encode character u'\u3042' in position 8: ordinal not in range(128) >> >> ====================================================================== >> ERROR: testBindUnicodeArrayDirect (UnicodeVar.TestUnicodeVar) >> test binding in a unicode array >> ---------------------------------------------------------------------- >> Traceback (most recent call last): >> File "test/UnicodeVar.py", line 71, in testBindUnicodeArrayDirect >> array = array) >> UnicodeEncodeError: 'ascii' codec can't encode character u'\u3042' in position 8: ordinal not in range(128) >> >> ====================================================================== >> ERROR: testUnicodeLength (UnicodeVar.TestUnicodeVar) >> test value length >> ---------------------------------------------------------------------- >> Traceback (most recent call last): >> File "test/UnicodeVar.py", line 28, in testUnicodeLength >> retval = returnValue) >> UnicodeEncodeError: 'ascii' codec can't encode character u'\u3042' in position 6: ordinal not in range(128) >> >> ====================================================================== >> FAIL: testBindDifferentVar (UnicodeVar.TestUnicodeVar) >> test binding a different variable on second execution >> ---------------------------------------------------------------------- >> Traceback (most recent call last): >> File "test/UnicodeVar.py", line 45, in testBindDifferentVar >> self.failUnlessEqual(retval_1.getvalue(), u"Called \u3042") >> AssertionError: u'Called ?' != u'Called \u3042' >> - Called ? >> ? ^ >> + Called \u3042 >> ? ^ >> >> >> ====================================================================== >> FAIL: testBindOutSetInputSizesByType (UnicodeVar.TestUnicodeVar) >> test binding out with set input sizes defined (by type) >> ---------------------------------------------------------------------- >> Traceback (most recent call last): >> File "test/UnicodeVar.py", line 153, in testBindOutSetInputSizesByType >> self.failUnlessEqual(vars["value"].getvalue(), u"TSI \u3042") >> AssertionError: u'TSI ?' != u'TSI \u3042' >> - TSI ? >> ? ^ >> + TSI \u3042 >> ? ^ >> >> >> ====================================================================== >> FAIL: testBindOutUnicodeArrayByVar (UnicodeVar.TestUnicodeVar) >> test binding out a unicode array (with arrayvar) >> ---------------------------------------------------------------------- >> Traceback (most recent call last): >> File "test/UnicodeVar.py", line 136, in testBindOutUnicodeArrayByVar >> self.failUnlessEqual(array.getvalue(), expectedData) >> AssertionError: Lists differ: [u'Test out element ? # 1', u'... != [u'Test out element \u3042 # 1... >> >> First differing element 0: >> Test out element ? # 1 >> Test out element \u3042 # 1 >> >> Diff is 720 characters long. Set self.maxDiff to None to see it. >> >> ====================================================================== >> FAIL: testBindOutVar (UnicodeVar.TestUnicodeVar) >> test binding out with cursor.var() method >> ---------------------------------------------------------------------- >> Traceback (most recent call last): >> File "test/UnicodeVar.py", line 174, in testBindOutVar >> self.failUnlessEqual(var.getvalue(), u"TSI (VAR) \u3042") >> AssertionError: u'TSI (VAR) ?' != u'TSI (VAR) \u3042' >> - TSI (VAR) ? >> ? ^ >> + TSI (VAR) \u3042 >> ? ^ >> >> >> ====================================================================== >> FAIL: testCursorDescription (UnicodeVar.TestUnicodeVar) >> test cursor description is accurate >> ---------------------------------------------------------------------- >> Traceback (most recent call last): >> File "test/UnicodeVar.py", line 207, in testCursorDescription >> ('NULLABLECOL', cx_Oracle.UNICODE, 50, 100, 0, 0, 1) ]) >> AssertionError: Lists differ: [('INTCOL', <type 'cx_Oracle.N... != [('INTCOL', <type 'cx_Oracle.N... >> >> First differing element 1: >> ('UNICODECOL', <type 'cx_Oracle.UNICODE'>, 20, 60, 0, 0, 0) >> ('UNICODECOL', <type 'cx_Oracle.UNICODE'>, 20, 40, 0, 0, 0) >> >> Diff is 815 characters long. Set self.maxDiff to None to see it. >> >> ====================================================================== >> FAIL: testFetchAll (UnicodeVar.TestUnicodeVar) >> test that fetching all of the data returns the correct results >> ---------------------------------------------------------------------- >> Traceback (most recent call last): >> File "test/UnicodeVar.py", line 212, in testFetchAll >> self.failUnlessEqual(self.cursor.fetchall(), self.rawData) >> AssertionError: Lists differ: [(1, u'Unicode ? 1', u'Fixed U... != [(1, u'Unicode \u3042 1', u'Fi... >> >> First differing element 0: >> (1, u'Unicode ? 1', u'Fixed Unicode 1 ', u'Nullable 1') >> (1, u'Unicode \u3042 1', u'Fixed Unicode 1 ', u'Nullable 1') >> >> Diff is 1806 characters long. Set self.maxDiff to None to see it. >> >> ====================================================================== >> FAIL: testFetchMany (UnicodeVar.TestUnicodeVar) >> test that fetching data in chunks returns the correct results >> ---------------------------------------------------------------------- >> Traceback (most recent call last): >> File "test/UnicodeVar.py", line 218, in testFetchMany >> self.failUnlessEqual(self.cursor.fetchmany(3), self.rawData[0:3]) >> AssertionError: Lists differ: [(1, u'Unicode ? 1', u'Fixed U... != [(1, u'Unicode \u3042 1', u'Fi... >> >> First differing element 0: >> (1, u'Unicode ? 1', u'Fixed Unicode 1 ', u'Nullable 1') >> (1, u'Unicode \u3042 1', u'Fixed Unicode 1 ', u'Nullable 1') >> >> [(1, >> - u'Unicode ? 1', >> ? ^ >> >> + u'Unicode \u3042 1', >> ? ^^^^^^ >> >> u'Fixed Unicode 1 ', >> u'Nullable 1'), >> - (2, u'Unicode ? 2', u'Fixed Unicode 2 ', None), >> ? ^ >> >> + (2, u'Unicode \u3042 2', u'Fixed Unicode 2 ', None), >> ? ^^^^^^ >> >> (3, >> - u'Unicode ? 3', >> ? ^ >> >> + u'Unicode \u3042 3', >> ? ^^^^^^ >> >> u'Fixed Unicode 3 ', >> u'Nullable 3')] >> >> >> ====================================================================== >> FAIL: testFetchOne (UnicodeVar.TestUnicodeVar) >> test that fetching a single row returns the correct results >> ---------------------------------------------------------------------- >> Traceback (most recent call last): >> File "test/UnicodeVar.py", line 231, in testFetchOne >> self.failUnlessEqual(self.cursor.fetchone(), self.dataByKey[3]) >> AssertionError: Tuples differ: (3, u'Unicode ? 3', u'Fixed Un... != (3, u'Unicode \u3042 3', u'Fix... >> >> First differing element 1: >> Unicode ? 3 >> Unicode \u3042 3 >> >> - (3, u'Unicode ? 3', u'Fixed Unicode 3 ', u'Nullable 3') >> + (3, >> + u'Unicode \u3042 3', >> + u'Fixed Unicode 3 ', >> + u'Nullable 3') >> >> ---------------------------------------------------------------------- >> Ran 19 tests in 5.071s >> >> >> -----Original Message----- >> From: Anthony Tuininga [mailto:ant...@gm...] >> Sent: Friday, September 02, 2011 6:22 AM >> To: cx-...@li... >> Subject: Re: [cx-oracle-users] ORA-03127 >> >> Ok, I tried with an 11g Release 1 database and was unable to replicate >> this problem. Thanks for the patch but unfortunately what you >> suggested doesn't seem to match the code that I have for 5.1 -- which >> now uses the default character set and simply converts to Unicode as >> needed. I don't think your patch actually helps in this case. :-( I >> checked that the code does what it should for NCLOBs and it seems to >> do so -- with both the default encoding and the UTF8 encoding. I did >> discover, though, that there was nothing in the test suite for NCLOBS >> so I added some tests for that that mirror the ones for CLOB and BLOB. >> I also attempted to call connection.close() deliberately in order to >> see if I could get the same error but I was unable to do so. Could I >> ask you to try the new test suite (don't forget to build the new >> TestNCLOBs table which can be built by running SetupTest.sql in the >> test subdirectory) and let me know if you get the problem with that >> code? That might help determine if this is generically a problem or a >> specific set of queries/commands. Thanks. >> >> Anthony >> >> On Mon, Aug 29, 2011 at 8:15 AM, Mike Elson <Mik...@eu...> wrote: >>> I've also seen this issue. The problem occurs when Django reads from the field SESSION_DATA, type NCLOB, in table DJANGO_SESSION. In cx_Oracle 5.1 the function ExternalLobVar_InternalRead() calls OCILobRead() with csid set to 0, whereas in 5.0.4 csid was set to OCI_UTF16ID when reading NCLOB fields. This causes OCILobRead() to fail but it is not reported at the time, leaving the cursor in an incomplete state and eventually an exception is thrown when the connection is closed. >>> >>> The error doesn't occur when I connect to an Oracle 10 database with NLS_NCHAR_CHARACTERSET of "AL16UTF16" but it does occur with an Oracle 11 database with NLS_NCHAR_CHARACTERSET set to "UTF8". >>> >>> Hope this helps! I put together a small patch (attached) that makes the problem go away but I'm not sure it's the correct fix. >>> >>> Regards, Mike. >>> >>>> Hi, >>>> >>>> I looked at it. The error is referring to the fact that the operations >>>> on the connection are not yet complete. Since it is taking place on a >>>> close() you can simply NOT do the close and allow it to close on its >>>> own when it goes out of scope. There was a change made to >>>> cursor.close() which may affect this but it seems unlikely. It would >>>> be helpful if you can provide a script that demonstrates the problem >>>> so that I can figure out why this might be happening. Thanks. I >>>> certainly have never run into this myself and I am using Django with >>>> cx_Oracle quite heavily. >>>> >>>> Anthony >>>> >>>> 2011/8/25 Sławek Ehlert <slafs.e@...>: >>>> > Hi there! >>>> > >>>> > Can You look at >>>> > >>>> > https://groups.google.com/d/topic/django-users/P9brNKIFwgI/discussion >>>> > >>>> > Recently I saw a similar problem when using cx_Oracle 5.1 when switching >>>> > Django 1.3 (Python 2.6) to another Oracle database (after syncing it) on >>>> > 64bit platform. >>>> > >>>> > Downgrading to 5.0.4 "solved" the problem. >>>> > >>>> > Regards >>>> > >>>> > Sławek >>>> > >>>> > >>>> > ------------------------------------------------------------------------------ >>>> > EMC VNX: the world's simplest storage, starting under $10K >>>> > The only unified storage solution that offers unified management >>>> > Up to 160% more powerful than alternatives and 25% more efficient. >>>> > Guaranteed. http://p.sf.net/sfu/emc-vnx-dev2dev >>>> > _______________________________________________ >>>> > cx-oracle-users mailing list >>>> > cx-oracle-users@... >>>> > https://lists.sourceforge.net/lists/listinfo/cx-oracle-users >>>> > >>>> > >>>> >>> >>> >>> ------------------------------------------------------------------------------ >>> EMC VNX: the world's simplest storage, starting under $10K >>> The only unified storage solution that offers unified management >>> Up to 160% more powerful than alternatives and 25% more efficient. >>> Guaranteed. http://p.sf.net/sfu/emc-vnx-dev2dev >>> _______________________________________________ >>> cx-oracle-users mailing list >>> cx-...@li... >>> https://lists.sourceforge.net/lists/listinfo/cx-oracle-users >>> >>> >> >> ------------------------------------------------------------------------------ >> Special Offer -- Download ArcSight Logger for FREE! >> Finally, a world-class log management solution at an even better >> price-free! And you'll get a free "Love Thy Logs" t-shirt when you >> download Logger. Secure your free ArcSight Logger TODAY! >> http://p.sf.net/sfu/arcsisghtdev2dev >> _______________________________________________ >> cx-oracle-users mailing list >> cx-...@li... >> https://lists.sourceforge.net/lists/listinfo/cx-oracle-users >> ------------------------------------------------------------------------------ >> Special Offer -- Download ArcSight Logger for FREE! >> Finally, a world-class log management solution at an even better >> price-free! And you'll get a free "Love Thy Logs" t-shirt when you >> download Logger. Secure your free ArcSight Logger TODAY! >> http://p.sf.net/sfu/arcsisghtdev2dev >> _______________________________________________ >> cx-oracle-users mailing list >> cx-...@li... >> https://lists.sourceforge.net/lists/listinfo/cx-oracle-users >> > ------------------------------------------------------------------------------ All the data continuously generated in your IT infrastructure contains a definitive record of customers, application performance, security threats, fraudulent activity and more. Splunk takes this data and makes sense of it. Business sense. IT sense. Common sense. http://p.sf.net/sfu/splunk-d2dcopy1 _______________________________________________ cx-oracle-users mailing list cx-...@li... https://lists.sourceforge.net/lists/listinfo/cx-oracle-users |
From: Robert <web...@gm...> - 2011-09-28 14:21:55
|
ha ! the other author is Steven F. Lott, author of the my favorite book on Python : "Building Skills in Python" On Wed, Sep 28, 2011 at 6:01 AM, Robert Lucente <rlu...@pi...> wrote: >......................... > To quickly and independently verify my background, check out the Dr. Dobb's > article that I co-authored at > > http://drdobbs.com/architecture-and-design/184406071 > > Please note that I was not the Java expert for the article. I was the > "database guy". |
From: Robert L. <rlu...@pi...> - 2011-09-28 10:02:02
|
>small cx_Oracle snippets that might help you get started Thanks >Well are you also new to relational database ? SQL ? No, I have extensive background w/ Oracle. I actually use to be an Oracle employee. I then worked as a production Oracle DBA at a startup and then at Fleet Credit Card services (use to be 1 of the 15 largest credit card companies). I then moved into more data modeling and PL/SQL development. To quickly and independently verify my background, check out the Dr. Dobb's article that I co-authored at http://drdobbs.com/architecture-and-design/184406071 Please note that I was not the Java expert for the article. I was the "database guy". >book has nothing to do w/ Python nor "open source" True. However, the book does talk about interfacing "languages" to "databases". It has entire chapters on ODBC, JDBC, and .Net. -----Original Message----- From: cx-...@li... [mailto:cx-...@li...] Sent: Tuesday, September 27, 2011 10:48 PM To: cx-...@li... Subject: cx-oracle-users Digest, Vol 63, Issue 6 Send cx-oracle-users mailing list submissions to cx-...@li... To subscribe or unsubscribe via the World Wide Web, visit https://lists.sourceforge.net/lists/listinfo/cx-oracle-users or, via email, send a message with subject or body 'help' to cx-...@li... You can reach the person managing the list at cx-...@li... When replying, please edit your Subject line so it is more specific than "Re: Contents of cx-oracle-users digest..." Today's Topics: 1. Book: The Data Access Handbook by John Goodson, Robert A. Steward (Robert Lucente) 2. Re: Book: The Data Access Handbook by John Goodson, Robert A. Steward (Mark Harrison) 3. Re: Book: The Data Access Handbook by John Goodson (Robert) 4. Re: ORA-03127 (Anthony Tuininga) ---------------------------------------------------------------------- Message: 1 Date: Mon, 26 Sep 2011 20:35:27 -0500 From: "Robert Lucente" <rlu...@pi...> Subject: [cx-oracle-users] Book: The Data Access Handbook by John Goodson, Robert A. Steward To: <cx-...@li...> Cc: Robert Lucente - Backup <rob...@gm...> Message-ID: <JEE...@pi...> Content-Type: text/plain; charset="iso-8859-1" I am new to Python and open source. Consequently, I am not sure what the appropriate behaviors are. Have you guys ever heard of the book in the subject line and if so what did you think of it? As a newbie, it seems a good book to at least get a list of things to go think about. ------------------------------ Message: 2 Date: Mon, 26 Sep 2011 23:17:32 -0700 From: Mark Harrison <mh...@pi...> Subject: Re: [cx-oracle-users] Book: The Data Access Handbook by John Goodson, Robert A. Steward To: cx-...@li... Message-ID: <4E8...@pi...> Content-Type: text/plain; charset=ISO-8859-1; format=flowed On 9/26/11 6:35 PM, Robert Lucente wrote: > I am new to Python and open source. Consequently, I am not sure what the > appropriate behaviors are. > > Have you guys ever heard of the book in the subject line and if so what did > you think of it? As a newbie, it seems a good book to at least get a list of > things to go think about. Haven't seen the book, but here's some small cx_Oracle snippets that might help you get started: http://markharrison.net/cx-oracle-demos ------------------------------ Message: 3 Date: Tue, 27 Sep 2011 11:57:14 -0400 From: Robert <web...@gm...> Subject: Re: [cx-oracle-users] Book: The Data Access Handbook by John Goodson To: cx-...@li... Message-ID: <CAJ...@ma...> Content-Type: text/plain; charset="iso-8859-1" Well are you also new to relational database ? SQL ? No, never heard of the book, and judging from the amazon page, i doubt you'll get a "yes" here. Your is a rather odd and vague question. The book has nothing to do w/ Python nor "open source" On 9/26/11 6:35 PM, Robert Lucente wrote: > > I am new to Python and open source. Consequently, I am not sure what the > > appropriate behaviors are. > > > > Have you guys ever heard of the book in the subject line and if so what > did > > you think of it? As a newbie, it seems a good book to at least get a list > of > > things to go think about. > > -------------- next part -------------- An HTML attachment was scrubbed... ------------------------------ Message: 4 Date: Tue, 27 Sep 2011 21:48:11 -0600 From: Anthony Tuininga <ant...@gm...> Subject: Re: [cx-oracle-users] ORA-03127 To: cx-...@li... Message-ID: <CAE1XR-5JNEDMJ4-+oQDdxEfY7eqmYNYf0obK=TCE...@ma...> Content-Type: text/plain; charset=UTF-8 All, I have checked in a change that uses OCI_UTF16ID for NCLOBs which seems to resolve the problem. I'd appreciate anyone who has noticed this problem checking it out and letting me know if this causes a problem anywhere else. I have run the test suite without any problems so not too likely but others testing would be helpful before I make a new release. I'd like to make the new release this week yet if possible. If you do get a chance to test, please let me know. Thanks. Anthony On Mon, Sep 5, 2011 at 7:44 AM, Anthony Tuininga <ant...@gm...> wrote: > Hi, > > Most of the errors you are noticing below are due to the fact that the > encoding you are using does not support the characters included in the > test suite. You will need to use an encoding that does support them -- > like UTF8. > > export NLS_LANG=.NTF8 > > is what I happen to use. > > In addition, I downloaded and installed 11.2.0.2 on my Linux box and > am now able to get the errors reported earlier -- so now I can look > into why this is happening and hopefully find a solution! Stay tuned. > :-) > > Anthony > > On Mon, Sep 5, 2011 at 3:51 AM, Mike Elson <Mik...@eu...> wrote: >> Hello Anthony, >> >> Thanks for looking into this. >> I ran the test suite and saw some Unicode related errors, see the relevant section pasted below. >> >> The client is Suse Linux, Python 2.7.2 cx_Oracle svn revision #359 (no modifications) and the >> database server parameters are: >> >> NLS_LANGUAGE ? ? ? ? ? ? ? ? ? AMERICAN >> NLS_TERRITORY ? ? ? ? ? ? ? ? ?AMERICA >> NLS_CURRENCY ? ? ? ? ? ? ? ? ? $ >> NLS_ISO_CURRENCY ? ? ? ? ? ? ? AMERICA >> NLS_NUMERIC_CHARACTERS ? ? ? ? ., >> NLS_CHARACTERSET ? ? ? ? ? ? ? WE8MSWIN1252 >> NLS_CALENDAR ? ? ? ? ? ? ? ? ? GREGORIAN >> NLS_DATE_FORMAT ? ? ? ? ? ? ? ?DD-MON-RR >> NLS_DATE_LANGUAGE ? ? ? ? ? ? ?AMERICAN >> NLS_SORT ? ? ? ? ? ? ? ? ? ? ? BINARY >> NLS_TIME_FORMAT ? ? ? ? ? ? ? ?HH.MI.SSXFF AM >> NLS_TIMESTAMP_FORMAT ? ? ? ? ? DD-MON-RR HH.MI.SSXFF AM >> NLS_TIME_TZ_FORMAT ? ? ? ? ? ? HH.MI.SSXFF AM TZR >> NLS_TIMESTAMP_TZ_FORMAT ? ? ? ?DD-MON-RR HH.MI.SSXFF AM TZR >> NLS_DUAL_CURRENCY ? ? ? ? ? ? ?$ >> NLS_COMP ? ? ? ? ? ? ? ? ? ? ? BINARY >> NLS_LENGTH_SEMANTICS ? ? ? ? ? BYTE >> NLS_NCHAR_CONV_EXCP ? ? ? ? ? ?FALSE >> NLS_NCHAR_CHARACTERSET ? ? ? ? UTF8 >> NLS_RDBMS_VERSION ? ? ? ? ? ? ?11.2.0.2.0 >> >> Output from "python setup.py test": >> >> Running tests in UnicodeVar.py >> testBindDifferentVar (UnicodeVar.TestUnicodeVar) >> test binding a different variable on second execution ... FAIL >> testBindInOutSetInputSizesByType (UnicodeVar.TestUnicodeVar) >> test binding in/out with set input sizes defined (by type) ... ERROR >> testBindInOutUnicodeArrayByVar (UnicodeVar.TestUnicodeVar) >> test binding in/out a unicode array (with arrayvar) ... ERROR >> testBindInOutVarDirectSet (UnicodeVar.TestUnicodeVar) >> test binding in/out with cursor.var() method ... ERROR >> testBindNull (UnicodeVar.TestUnicodeVar) >> test binding in a null ... ok >> testBindOutSetInputSizesByType (UnicodeVar.TestUnicodeVar) >> test binding out with set input sizes defined (by type) ... FAIL >> testBindOutUnicodeArrayByVar (UnicodeVar.TestUnicodeVar) >> test binding out a unicode array (with arrayvar) ... FAIL >> testBindOutVar (UnicodeVar.TestUnicodeVar) >> test binding out with cursor.var() method ... FAIL >> testBindUnicode (UnicodeVar.TestUnicodeVar) >> test binding in a unicode ... ERROR >> testBindUnicodeAfterNumber (UnicodeVar.TestUnicodeVar) >> test binding in a unicode after setting input sizes to a number ... ERROR >> testBindUnicodeArrayBySizes (UnicodeVar.TestUnicodeVar) >> test binding in a unicode array (with setinputsizes) ... ERROR >> testBindUnicodeArrayByVar (UnicodeVar.TestUnicodeVar) >> test binding in a unicode array (with arrayvar) ... ERROR >> testBindUnicodeArrayDirect (UnicodeVar.TestUnicodeVar) >> test binding in a unicode array ... ERROR >> testCursorDescription (UnicodeVar.TestUnicodeVar) >> test cursor description is accurate ... FAIL >> testFetchAll (UnicodeVar.TestUnicodeVar) >> test that fetching all of the data returns the correct results ... FAIL >> testFetchMany (UnicodeVar.TestUnicodeVar) >> test that fetching data in chunks returns the correct results ... FAIL >> testFetchOne (UnicodeVar.TestUnicodeVar) >> test that fetching a single row returns the correct results ... FAIL >> testUnicodeLength (UnicodeVar.TestUnicodeVar) >> test value length ... ERROR >> testUnicodeMaximumReached (UnicodeVar.TestUnicodeVar) >> test that an error is raised when maximum unicode length exceeded ... ok >> >> ====================================================================== >> ERROR: testBindInOutSetInputSizesByType (UnicodeVar.TestUnicodeVar) >> test binding in/out with set input sizes defined (by type) >> ---------------------------------------------------------------------- >> Traceback (most recent call last): >> ?File "test/UnicodeVar.py", line 162, in testBindInOutSetInputSizesByType >> ? ?value = u"InVal \u3041") >> UnicodeEncodeError: 'ascii' codec can't encode character u'\u3041' in position 6: ordinal not in range(128) >> >> ====================================================================== >> ERROR: testBindInOutUnicodeArrayByVar (UnicodeVar.TestUnicodeVar) >> test binding in/out a unicode array (with arrayvar) >> ---------------------------------------------------------------------- >> Traceback (most recent call last): >> ?File "test/UnicodeVar.py", line 116, in testBindInOutUnicodeArrayByVar >> ? ?array.setvalue(0, originalData) >> UnicodeEncodeError: 'ascii' codec can't encode character u'\u3042' in position 8: ordinal not in range(128) >> >> ====================================================================== >> ERROR: testBindInOutVarDirectSet (UnicodeVar.TestUnicodeVar) >> test binding in/out with cursor.var() method >> ---------------------------------------------------------------------- >> Traceback (most recent call last): >> ?File "test/UnicodeVar.py", line 179, in testBindInOutVarDirectSet >> ? ?var.setvalue(0, u"InVal \u3041") >> UnicodeEncodeError: 'ascii' codec can't encode character u'\u3041' in position 6: ordinal not in range(128) >> >> ====================================================================== >> ERROR: testBindUnicode (UnicodeVar.TestUnicodeVar) >> test binding in a unicode >> ---------------------------------------------------------------------- >> Traceback (most recent call last): >> ?File "test/UnicodeVar.py", line 36, in testBindUnicode >> ? ?value = u"Unicode \u3042 5") >> UnicodeEncodeError: 'ascii' codec can't encode character u'\u3042' in position 8: ordinal not in range(128) >> >> ====================================================================== >> ERROR: testBindUnicodeAfterNumber (UnicodeVar.TestUnicodeVar) >> test binding in a unicode after setting input sizes to a number >> ---------------------------------------------------------------------- >> Traceback (most recent call last): >> ?File "test/UnicodeVar.py", line 56, in testBindUnicodeAfterNumber >> ? ?value = u"Unicode \u3042 6") >> UnicodeEncodeError: 'ascii' codec can't encode character u'\u3042' in position 8: ordinal not in range(128) >> >> ====================================================================== >> ERROR: testBindUnicodeArrayBySizes (UnicodeVar.TestUnicodeVar) >> test binding in a unicode array (with setinputsizes) >> ---------------------------------------------------------------------- >> Traceback (most recent call last): >> ?File "test/UnicodeVar.py", line 91, in testBindUnicodeArrayBySizes >> ? ?array = array) >> UnicodeEncodeError: 'ascii' codec can't encode character u'\u3042' in position 8: ordinal not in range(128) >> >> ====================================================================== >> ERROR: testBindUnicodeArrayByVar (UnicodeVar.TestUnicodeVar) >> test binding in a unicode array (with arrayvar) >> ---------------------------------------------------------------------- >> Traceback (most recent call last): >> ?File "test/UnicodeVar.py", line 98, in testBindUnicodeArrayByVar >> ? ?array.setvalue(0, [r[1] for r in self.rawData]) >> UnicodeEncodeError: 'ascii' codec can't encode character u'\u3042' in position 8: ordinal not in range(128) >> >> ====================================================================== >> ERROR: testBindUnicodeArrayDirect (UnicodeVar.TestUnicodeVar) >> test binding in a unicode array >> ---------------------------------------------------------------------- >> Traceback (most recent call last): >> ?File "test/UnicodeVar.py", line 71, in testBindUnicodeArrayDirect >> ? ?array = array) >> UnicodeEncodeError: 'ascii' codec can't encode character u'\u3042' in position 8: ordinal not in range(128) >> >> ====================================================================== >> ERROR: testUnicodeLength (UnicodeVar.TestUnicodeVar) >> test value length >> ---------------------------------------------------------------------- >> Traceback (most recent call last): >> ?File "test/UnicodeVar.py", line 28, in testUnicodeLength >> ? ?retval = returnValue) >> UnicodeEncodeError: 'ascii' codec can't encode character u'\u3042' in position 6: ordinal not in range(128) >> >> ====================================================================== >> FAIL: testBindDifferentVar (UnicodeVar.TestUnicodeVar) >> test binding a different variable on second execution >> ---------------------------------------------------------------------- >> Traceback (most recent call last): >> ?File "test/UnicodeVar.py", line 45, in testBindDifferentVar >> ? ?self.failUnlessEqual(retval_1.getvalue(), u"Called \u3042") >> AssertionError: u'Called ?' != u'Called \u3042' >> - Called ? >> ? ? ? ? ?^ >> + Called \u3042 >> ? ? ? ? ?^ >> >> >> ====================================================================== >> FAIL: testBindOutSetInputSizesByType (UnicodeVar.TestUnicodeVar) >> test binding out with set input sizes defined (by type) >> ---------------------------------------------------------------------- >> Traceback (most recent call last): >> ?File "test/UnicodeVar.py", line 153, in testBindOutSetInputSizesByType >> ? ?self.failUnlessEqual(vars["value"].getvalue(), u"TSI \u3042") >> AssertionError: u'TSI ?' != u'TSI \u3042' >> - TSI ? >> ? ? ? ^ >> + TSI \u3042 >> ? ? ? ^ >> >> >> ====================================================================== >> FAIL: testBindOutUnicodeArrayByVar (UnicodeVar.TestUnicodeVar) >> test binding out a unicode array (with arrayvar) >> ---------------------------------------------------------------------- >> Traceback (most recent call last): >> ?File "test/UnicodeVar.py", line 136, in testBindOutUnicodeArrayByVar >> ? ?self.failUnlessEqual(array.getvalue(), expectedData) >> AssertionError: Lists differ: [u'Test out element ? # 1', u'... != [u'Test out element \u3042 # 1... >> >> First differing element 0: >> Test out element ? # 1 >> Test out element \u3042 # 1 >> >> Diff is 720 characters long. Set self.maxDiff to None to see it. >> >> ====================================================================== >> FAIL: testBindOutVar (UnicodeVar.TestUnicodeVar) >> test binding out with cursor.var() method >> ---------------------------------------------------------------------- >> Traceback (most recent call last): >> ?File "test/UnicodeVar.py", line 174, in testBindOutVar >> ? ?self.failUnlessEqual(var.getvalue(), u"TSI (VAR) \u3042") >> AssertionError: u'TSI (VAR) ?' != u'TSI (VAR) \u3042' >> - TSI (VAR) ? >> ? ? ? ? ? ? ^ >> + TSI (VAR) \u3042 >> ? ? ? ? ? ? ^ >> >> >> ====================================================================== >> FAIL: testCursorDescription (UnicodeVar.TestUnicodeVar) >> test cursor description is accurate >> ---------------------------------------------------------------------- >> Traceback (most recent call last): >> ?File "test/UnicodeVar.py", line 207, in testCursorDescription >> ? ?('NULLABLECOL', cx_Oracle.UNICODE, 50, 100, 0, 0, 1) ]) >> AssertionError: Lists differ: [('INTCOL', <type 'cx_Oracle.N... != [('INTCOL', <type 'cx_Oracle.N... >> >> First differing element 1: >> ('UNICODECOL', <type 'cx_Oracle.UNICODE'>, 20, 60, 0, 0, 0) >> ('UNICODECOL', <type 'cx_Oracle.UNICODE'>, 20, 40, 0, 0, 0) >> >> Diff is 815 characters long. Set self.maxDiff to None to see it. >> >> ====================================================================== >> FAIL: testFetchAll (UnicodeVar.TestUnicodeVar) >> test that fetching all of the data returns the correct results >> ---------------------------------------------------------------------- >> Traceback (most recent call last): >> ?File "test/UnicodeVar.py", line 212, in testFetchAll >> ? ?self.failUnlessEqual(self.cursor.fetchall(), self.rawData) >> AssertionError: Lists differ: [(1, u'Unicode ? 1', u'Fixed U... != [(1, u'Unicode \u3042 1', u'Fi... >> >> First differing element 0: >> (1, u'Unicode ? 1', u'Fixed Unicode 1 ? ? ? ? ? ? ? ? ? ? ? ? ', u'Nullable 1') >> (1, u'Unicode \u3042 1', u'Fixed Unicode 1 ? ? ? ? ? ? ? ? ? ? ? ? ', u'Nullable 1') >> >> Diff is 1806 characters long. Set self.maxDiff to None to see it. >> >> ====================================================================== >> FAIL: testFetchMany (UnicodeVar.TestUnicodeVar) >> test that fetching data in chunks returns the correct results >> ---------------------------------------------------------------------- >> Traceback (most recent call last): >> ?File "test/UnicodeVar.py", line 218, in testFetchMany >> ? ?self.failUnlessEqual(self.cursor.fetchmany(3), self.rawData[0:3]) >> AssertionError: Lists differ: [(1, u'Unicode ? 1', u'Fixed U... != [(1, u'Unicode \u3042 1', u'Fi... >> >> First differing element 0: >> (1, u'Unicode ? 1', u'Fixed Unicode 1 ? ? ? ? ? ? ? ? ? ? ? ? ', u'Nullable 1') >> (1, u'Unicode \u3042 1', u'Fixed Unicode 1 ? ? ? ? ? ? ? ? ? ? ? ? ', u'Nullable 1') >> >> ?[(1, >> - ? u'Unicode ? 1', >> ? ? ? ? ? ? ? ^ >> >> + ? u'Unicode \u3042 1', >> ? ? ? ? ? ? ? ^^^^^^ >> >> ? ?u'Fixed Unicode 1 ? ? ? ? ? ? ? ? ? ? ? ? ', >> ? ?u'Nullable 1'), >> - ?(2, u'Unicode ? 2', u'Fixed Unicode 2 ? ? ? ? ? ? ? ? ? ? ? ? ', None), >> ? ? ? ? ? ? ? ? ?^ >> >> + ?(2, u'Unicode \u3042 2', u'Fixed Unicode 2 ? ? ? ? ? ? ? ? ? ? ? ? ', None), >> ? ? ? ? ? ? ? ? ?^^^^^^ >> >> ? (3, >> - ? u'Unicode ? 3', >> ? ? ? ? ? ? ? ^ >> >> + ? u'Unicode \u3042 3', >> ? ? ? ? ? ? ? ^^^^^^ >> >> ? ?u'Fixed Unicode 3 ? ? ? ? ? ? ? ? ? ? ? ? ', >> ? ?u'Nullable 3')] >> >> >> ====================================================================== >> FAIL: testFetchOne (UnicodeVar.TestUnicodeVar) >> test that fetching a single row returns the correct results >> ---------------------------------------------------------------------- >> Traceback (most recent call last): >> ?File "test/UnicodeVar.py", line 231, in testFetchOne >> ? ?self.failUnlessEqual(self.cursor.fetchone(), self.dataByKey[3]) >> AssertionError: Tuples differ: (3, u'Unicode ? 3', u'Fixed Un... != (3, u'Unicode \u3042 3', u'Fix... >> >> First differing element 1: >> Unicode ? 3 >> Unicode \u3042 3 >> >> - (3, u'Unicode ? 3', u'Fixed Unicode 3 ? ? ? ? ? ? ? ? ? ? ? ? ', u'Nullable 3') >> + (3, >> + ?u'Unicode \u3042 3', >> + ?u'Fixed Unicode 3 ? ? ? ? ? ? ? ? ? ? ? ? ', >> + ?u'Nullable 3') >> >> ---------------------------------------------------------------------- >> Ran 19 tests in 5.071s >> >> >> -----Original Message----- >> From: Anthony Tuininga [mailto:ant...@gm...] >> Sent: Friday, September 02, 2011 6:22 AM >> To: cx-...@li... >> Subject: Re: [cx-oracle-users] ORA-03127 >> >> Ok, I tried with an 11g Release 1 database and was unable to replicate >> this problem. Thanks for the patch but unfortunately what you >> suggested doesn't seem to match the code that I have for 5.1 -- which >> now uses the default character set and simply converts to Unicode as >> needed. I don't think your patch actually helps in this case. :-( I >> checked that the code does what it should for NCLOBs and it seems to >> do so -- with both the default encoding and the UTF8 encoding. I did >> discover, though, that there was nothing in the test suite for NCLOBS >> so I added some tests for that that mirror the ones for CLOB and BLOB. >> I also attempted to call connection.close() deliberately in order to >> see if I could get the same error but I was unable to do so. Could I >> ask you to try the new test suite (don't forget to build the new >> TestNCLOBs table which can be built by running SetupTest.sql in the >> test subdirectory) and let me know if you get the problem with that >> code? That might help determine if this is generically a problem or a >> specific set of queries/commands. Thanks. >> >> Anthony >> >> On Mon, Aug 29, 2011 at 8:15 AM, Mike Elson <Mik...@eu...> wrote: >>> I've also seen this issue. The problem occurs when Django reads from the field SESSION_DATA, type NCLOB, in table DJANGO_SESSION. In cx_Oracle 5.1 the function ExternalLobVar_InternalRead() calls OCILobRead() with csid set to 0, whereas in 5.0.4 csid was set to OCI_UTF16ID when reading NCLOB fields. This causes OCILobRead() to fail but it is not reported at the time, leaving the cursor in an incomplete state and eventually an exception is thrown when the connection is closed. >>> >>> The error doesn't occur when I connect to an Oracle 10 database with NLS_NCHAR_CHARACTERSET of ?"AL16UTF16" but it does occur with an Oracle 11 database with NLS_NCHAR_CHARACTERSET set to "UTF8". >>> >>> Hope this helps! I put together a small patch (attached) that makes the problem go away but I'm not sure it's the correct fix. >>> >>> Regards, Mike. >>> >>>> Hi, >>>> >>>> I looked at it. The error is referring to the fact that the operations >>>> on the connection are not yet complete. Since it is taking place on a >>>> close() you can simply NOT do the close and allow it to close on its >>>> own when it goes out of scope. There was a change made to >>>> cursor.close() which may affect this but it seems unlikely. It would >>>> be helpful if you can provide a script that demonstrates the problem >>>> so that I can figure out why this might be happening. Thanks. I >>>> certainly have never run into this myself and I am using Django with >>>> cx_Oracle quite heavily. >>>> >>>> Anthony >>>> >>>> 2011/8/25 S?awek Ehlert <slafs.e@...>: >>>> > Hi there! >>>> > >>>> > Can You look at >>>> > >>>> > https://groups.google.com/d/topic/django-users/P9brNKIFwgI/discussion >>>> > >>>> > Recently I saw a similar problem when using cx_Oracle 5.1 when switching >>>> > Django 1.3 (Python 2.6) to another Oracle database (after syncing it) on >>>> > 64bit platform. >>>> > >>>> > Downgrading to 5.0.4 "solved" the problem. >>>> > >>>> > Regards >>>> > >>>> > S?awek >>>> > >>>> > >>>> > -------------------------------------------------------------------------- ---- >>>> > EMC VNX: the world's simplest storage, starting under $10K >>>> > The only unified storage solution that offers unified management >>>> > Up to 160% more powerful than alternatives and 25% more efficient. >>>> > Guaranteed. http://p.sf.net/sfu/emc-vnx-dev2dev >>>> > _______________________________________________ >>>> > cx-oracle-users mailing list >>>> > cx-oracle-users@... >>>> > https://lists.sourceforge.net/lists/listinfo/cx-oracle-users >>>> > >>>> > >>>> >>> >>> >>> ------------------------------------------------------------------------ ------ >>> EMC VNX: the world's simplest storage, starting under $10K >>> The only unified storage solution that offers unified management >>> Up to 160% more powerful than alternatives and 25% more efficient. >>> Guaranteed. http://p.sf.net/sfu/emc-vnx-dev2dev >>> _______________________________________________ >>> cx-oracle-users mailing list >>> cx-...@li... >>> https://lists.sourceforge.net/lists/listinfo/cx-oracle-users >>> >>> >> >> ------------------------------------------------------------------------- ----- >> Special Offer -- Download ArcSight Logger for FREE! >> Finally, a world-class log management solution at an even better >> price-free! And you'll get a free "Love Thy Logs" t-shirt when you >> download Logger. Secure your free ArcSight Logger TODAY! >> http://p.sf.net/sfu/arcsisghtdev2dev >> _______________________________________________ >> cx-oracle-users mailing list >> cx-...@li... >> https://lists.sourceforge.net/lists/listinfo/cx-oracle-users >> ------------------------------------------------------------------------- ----- >> Special Offer -- Download ArcSight Logger for FREE! >> Finally, a world-class log management solution at an even better >> price-free! And you'll get a free "Love Thy Logs" t-shirt when you >> download Logger. Secure your free ArcSight Logger TODAY! >> http://p.sf.net/sfu/arcsisghtdev2dev >> _______________________________________________ >> cx-oracle-users mailing list >> cx-...@li... >> https://lists.sourceforge.net/lists/listinfo/cx-oracle-users >> > ------------------------------ ---------------------------------------------------------------------------- -- All the data continuously generated in your IT infrastructure contains a definitive record of customers, application performance, security threats, fraudulent activity and more. Splunk takes this data and makes sense of it. Business sense. IT sense. Common sense. http://p.sf.net/sfu/splunk-d2dcopy1 ------------------------------ _______________________________________________ cx-oracle-users mailing list cx-...@li... https://lists.sourceforge.net/lists/listinfo/cx-oracle-users End of cx-oracle-users Digest, Vol 63, Issue 6 ********************************************** |
From: Anthony T. <ant...@gm...> - 2011-09-28 03:48:19
|
All, I have checked in a change that uses OCI_UTF16ID for NCLOBs which seems to resolve the problem. I'd appreciate anyone who has noticed this problem checking it out and letting me know if this causes a problem anywhere else. I have run the test suite without any problems so not too likely but others testing would be helpful before I make a new release. I'd like to make the new release this week yet if possible. If you do get a chance to test, please let me know. Thanks. Anthony On Mon, Sep 5, 2011 at 7:44 AM, Anthony Tuininga <ant...@gm...> wrote: > Hi, > > Most of the errors you are noticing below are due to the fact that the > encoding you are using does not support the characters included in the > test suite. You will need to use an encoding that does support them -- > like UTF8. > > export NLS_LANG=.NTF8 > > is what I happen to use. > > In addition, I downloaded and installed 11.2.0.2 on my Linux box and > am now able to get the errors reported earlier -- so now I can look > into why this is happening and hopefully find a solution! Stay tuned. > :-) > > Anthony > > On Mon, Sep 5, 2011 at 3:51 AM, Mike Elson <Mik...@eu...> wrote: >> Hello Anthony, >> >> Thanks for looking into this. >> I ran the test suite and saw some Unicode related errors, see the relevant section pasted below. >> >> The client is Suse Linux, Python 2.7.2 cx_Oracle svn revision #359 (no modifications) and the >> database server parameters are: >> >> NLS_LANGUAGE AMERICAN >> NLS_TERRITORY AMERICA >> NLS_CURRENCY $ >> NLS_ISO_CURRENCY AMERICA >> NLS_NUMERIC_CHARACTERS ., >> NLS_CHARACTERSET WE8MSWIN1252 >> NLS_CALENDAR GREGORIAN >> NLS_DATE_FORMAT DD-MON-RR >> NLS_DATE_LANGUAGE AMERICAN >> NLS_SORT BINARY >> NLS_TIME_FORMAT HH.MI.SSXFF AM >> NLS_TIMESTAMP_FORMAT DD-MON-RR HH.MI.SSXFF AM >> NLS_TIME_TZ_FORMAT HH.MI.SSXFF AM TZR >> NLS_TIMESTAMP_TZ_FORMAT DD-MON-RR HH.MI.SSXFF AM TZR >> NLS_DUAL_CURRENCY $ >> NLS_COMP BINARY >> NLS_LENGTH_SEMANTICS BYTE >> NLS_NCHAR_CONV_EXCP FALSE >> NLS_NCHAR_CHARACTERSET UTF8 >> NLS_RDBMS_VERSION 11.2.0.2.0 >> >> Output from "python setup.py test": >> >> Running tests in UnicodeVar.py >> testBindDifferentVar (UnicodeVar.TestUnicodeVar) >> test binding a different variable on second execution ... FAIL >> testBindInOutSetInputSizesByType (UnicodeVar.TestUnicodeVar) >> test binding in/out with set input sizes defined (by type) ... ERROR >> testBindInOutUnicodeArrayByVar (UnicodeVar.TestUnicodeVar) >> test binding in/out a unicode array (with arrayvar) ... ERROR >> testBindInOutVarDirectSet (UnicodeVar.TestUnicodeVar) >> test binding in/out with cursor.var() method ... ERROR >> testBindNull (UnicodeVar.TestUnicodeVar) >> test binding in a null ... ok >> testBindOutSetInputSizesByType (UnicodeVar.TestUnicodeVar) >> test binding out with set input sizes defined (by type) ... FAIL >> testBindOutUnicodeArrayByVar (UnicodeVar.TestUnicodeVar) >> test binding out a unicode array (with arrayvar) ... FAIL >> testBindOutVar (UnicodeVar.TestUnicodeVar) >> test binding out with cursor.var() method ... FAIL >> testBindUnicode (UnicodeVar.TestUnicodeVar) >> test binding in a unicode ... ERROR >> testBindUnicodeAfterNumber (UnicodeVar.TestUnicodeVar) >> test binding in a unicode after setting input sizes to a number ... ERROR >> testBindUnicodeArrayBySizes (UnicodeVar.TestUnicodeVar) >> test binding in a unicode array (with setinputsizes) ... ERROR >> testBindUnicodeArrayByVar (UnicodeVar.TestUnicodeVar) >> test binding in a unicode array (with arrayvar) ... ERROR >> testBindUnicodeArrayDirect (UnicodeVar.TestUnicodeVar) >> test binding in a unicode array ... ERROR >> testCursorDescription (UnicodeVar.TestUnicodeVar) >> test cursor description is accurate ... FAIL >> testFetchAll (UnicodeVar.TestUnicodeVar) >> test that fetching all of the data returns the correct results ... FAIL >> testFetchMany (UnicodeVar.TestUnicodeVar) >> test that fetching data in chunks returns the correct results ... FAIL >> testFetchOne (UnicodeVar.TestUnicodeVar) >> test that fetching a single row returns the correct results ... FAIL >> testUnicodeLength (UnicodeVar.TestUnicodeVar) >> test value length ... ERROR >> testUnicodeMaximumReached (UnicodeVar.TestUnicodeVar) >> test that an error is raised when maximum unicode length exceeded ... ok >> >> ====================================================================== >> ERROR: testBindInOutSetInputSizesByType (UnicodeVar.TestUnicodeVar) >> test binding in/out with set input sizes defined (by type) >> ---------------------------------------------------------------------- >> Traceback (most recent call last): >> File "test/UnicodeVar.py", line 162, in testBindInOutSetInputSizesByType >> value = u"InVal \u3041") >> UnicodeEncodeError: 'ascii' codec can't encode character u'\u3041' in position 6: ordinal not in range(128) >> >> ====================================================================== >> ERROR: testBindInOutUnicodeArrayByVar (UnicodeVar.TestUnicodeVar) >> test binding in/out a unicode array (with arrayvar) >> ---------------------------------------------------------------------- >> Traceback (most recent call last): >> File "test/UnicodeVar.py", line 116, in testBindInOutUnicodeArrayByVar >> array.setvalue(0, originalData) >> UnicodeEncodeError: 'ascii' codec can't encode character u'\u3042' in position 8: ordinal not in range(128) >> >> ====================================================================== >> ERROR: testBindInOutVarDirectSet (UnicodeVar.TestUnicodeVar) >> test binding in/out with cursor.var() method >> ---------------------------------------------------------------------- >> Traceback (most recent call last): >> File "test/UnicodeVar.py", line 179, in testBindInOutVarDirectSet >> var.setvalue(0, u"InVal \u3041") >> UnicodeEncodeError: 'ascii' codec can't encode character u'\u3041' in position 6: ordinal not in range(128) >> >> ====================================================================== >> ERROR: testBindUnicode (UnicodeVar.TestUnicodeVar) >> test binding in a unicode >> ---------------------------------------------------------------------- >> Traceback (most recent call last): >> File "test/UnicodeVar.py", line 36, in testBindUnicode >> value = u"Unicode \u3042 5") >> UnicodeEncodeError: 'ascii' codec can't encode character u'\u3042' in position 8: ordinal not in range(128) >> >> ====================================================================== >> ERROR: testBindUnicodeAfterNumber (UnicodeVar.TestUnicodeVar) >> test binding in a unicode after setting input sizes to a number >> ---------------------------------------------------------------------- >> Traceback (most recent call last): >> File "test/UnicodeVar.py", line 56, in testBindUnicodeAfterNumber >> value = u"Unicode \u3042 6") >> UnicodeEncodeError: 'ascii' codec can't encode character u'\u3042' in position 8: ordinal not in range(128) >> >> ====================================================================== >> ERROR: testBindUnicodeArrayBySizes (UnicodeVar.TestUnicodeVar) >> test binding in a unicode array (with setinputsizes) >> ---------------------------------------------------------------------- >> Traceback (most recent call last): >> File "test/UnicodeVar.py", line 91, in testBindUnicodeArrayBySizes >> array = array) >> UnicodeEncodeError: 'ascii' codec can't encode character u'\u3042' in position 8: ordinal not in range(128) >> >> ====================================================================== >> ERROR: testBindUnicodeArrayByVar (UnicodeVar.TestUnicodeVar) >> test binding in a unicode array (with arrayvar) >> ---------------------------------------------------------------------- >> Traceback (most recent call last): >> File "test/UnicodeVar.py", line 98, in testBindUnicodeArrayByVar >> array.setvalue(0, [r[1] for r in self.rawData]) >> UnicodeEncodeError: 'ascii' codec can't encode character u'\u3042' in position 8: ordinal not in range(128) >> >> ====================================================================== >> ERROR: testBindUnicodeArrayDirect (UnicodeVar.TestUnicodeVar) >> test binding in a unicode array >> ---------------------------------------------------------------------- >> Traceback (most recent call last): >> File "test/UnicodeVar.py", line 71, in testBindUnicodeArrayDirect >> array = array) >> UnicodeEncodeError: 'ascii' codec can't encode character u'\u3042' in position 8: ordinal not in range(128) >> >> ====================================================================== >> ERROR: testUnicodeLength (UnicodeVar.TestUnicodeVar) >> test value length >> ---------------------------------------------------------------------- >> Traceback (most recent call last): >> File "test/UnicodeVar.py", line 28, in testUnicodeLength >> retval = returnValue) >> UnicodeEncodeError: 'ascii' codec can't encode character u'\u3042' in position 6: ordinal not in range(128) >> >> ====================================================================== >> FAIL: testBindDifferentVar (UnicodeVar.TestUnicodeVar) >> test binding a different variable on second execution >> ---------------------------------------------------------------------- >> Traceback (most recent call last): >> File "test/UnicodeVar.py", line 45, in testBindDifferentVar >> self.failUnlessEqual(retval_1.getvalue(), u"Called \u3042") >> AssertionError: u'Called ?' != u'Called \u3042' >> - Called ? >> ? ^ >> + Called \u3042 >> ? ^ >> >> >> ====================================================================== >> FAIL: testBindOutSetInputSizesByType (UnicodeVar.TestUnicodeVar) >> test binding out with set input sizes defined (by type) >> ---------------------------------------------------------------------- >> Traceback (most recent call last): >> File "test/UnicodeVar.py", line 153, in testBindOutSetInputSizesByType >> self.failUnlessEqual(vars["value"].getvalue(), u"TSI \u3042") >> AssertionError: u'TSI ?' != u'TSI \u3042' >> - TSI ? >> ? ^ >> + TSI \u3042 >> ? ^ >> >> >> ====================================================================== >> FAIL: testBindOutUnicodeArrayByVar (UnicodeVar.TestUnicodeVar) >> test binding out a unicode array (with arrayvar) >> ---------------------------------------------------------------------- >> Traceback (most recent call last): >> File "test/UnicodeVar.py", line 136, in testBindOutUnicodeArrayByVar >> self.failUnlessEqual(array.getvalue(), expectedData) >> AssertionError: Lists differ: [u'Test out element ? # 1', u'... != [u'Test out element \u3042 # 1... >> >> First differing element 0: >> Test out element ? # 1 >> Test out element \u3042 # 1 >> >> Diff is 720 characters long. Set self.maxDiff to None to see it. >> >> ====================================================================== >> FAIL: testBindOutVar (UnicodeVar.TestUnicodeVar) >> test binding out with cursor.var() method >> ---------------------------------------------------------------------- >> Traceback (most recent call last): >> File "test/UnicodeVar.py", line 174, in testBindOutVar >> self.failUnlessEqual(var.getvalue(), u"TSI (VAR) \u3042") >> AssertionError: u'TSI (VAR) ?' != u'TSI (VAR) \u3042' >> - TSI (VAR) ? >> ? ^ >> + TSI (VAR) \u3042 >> ? ^ >> >> >> ====================================================================== >> FAIL: testCursorDescription (UnicodeVar.TestUnicodeVar) >> test cursor description is accurate >> ---------------------------------------------------------------------- >> Traceback (most recent call last): >> File "test/UnicodeVar.py", line 207, in testCursorDescription >> ('NULLABLECOL', cx_Oracle.UNICODE, 50, 100, 0, 0, 1) ]) >> AssertionError: Lists differ: [('INTCOL', <type 'cx_Oracle.N... != [('INTCOL', <type 'cx_Oracle.N... >> >> First differing element 1: >> ('UNICODECOL', <type 'cx_Oracle.UNICODE'>, 20, 60, 0, 0, 0) >> ('UNICODECOL', <type 'cx_Oracle.UNICODE'>, 20, 40, 0, 0, 0) >> >> Diff is 815 characters long. Set self.maxDiff to None to see it. >> >> ====================================================================== >> FAIL: testFetchAll (UnicodeVar.TestUnicodeVar) >> test that fetching all of the data returns the correct results >> ---------------------------------------------------------------------- >> Traceback (most recent call last): >> File "test/UnicodeVar.py", line 212, in testFetchAll >> self.failUnlessEqual(self.cursor.fetchall(), self.rawData) >> AssertionError: Lists differ: [(1, u'Unicode ? 1', u'Fixed U... != [(1, u'Unicode \u3042 1', u'Fi... >> >> First differing element 0: >> (1, u'Unicode ? 1', u'Fixed Unicode 1 ', u'Nullable 1') >> (1, u'Unicode \u3042 1', u'Fixed Unicode 1 ', u'Nullable 1') >> >> Diff is 1806 characters long. Set self.maxDiff to None to see it. >> >> ====================================================================== >> FAIL: testFetchMany (UnicodeVar.TestUnicodeVar) >> test that fetching data in chunks returns the correct results >> ---------------------------------------------------------------------- >> Traceback (most recent call last): >> File "test/UnicodeVar.py", line 218, in testFetchMany >> self.failUnlessEqual(self.cursor.fetchmany(3), self.rawData[0:3]) >> AssertionError: Lists differ: [(1, u'Unicode ? 1', u'Fixed U... != [(1, u'Unicode \u3042 1', u'Fi... >> >> First differing element 0: >> (1, u'Unicode ? 1', u'Fixed Unicode 1 ', u'Nullable 1') >> (1, u'Unicode \u3042 1', u'Fixed Unicode 1 ', u'Nullable 1') >> >> [(1, >> - u'Unicode ? 1', >> ? ^ >> >> + u'Unicode \u3042 1', >> ? ^^^^^^ >> >> u'Fixed Unicode 1 ', >> u'Nullable 1'), >> - (2, u'Unicode ? 2', u'Fixed Unicode 2 ', None), >> ? ^ >> >> + (2, u'Unicode \u3042 2', u'Fixed Unicode 2 ', None), >> ? ^^^^^^ >> >> (3, >> - u'Unicode ? 3', >> ? ^ >> >> + u'Unicode \u3042 3', >> ? ^^^^^^ >> >> u'Fixed Unicode 3 ', >> u'Nullable 3')] >> >> >> ====================================================================== >> FAIL: testFetchOne (UnicodeVar.TestUnicodeVar) >> test that fetching a single row returns the correct results >> ---------------------------------------------------------------------- >> Traceback (most recent call last): >> File "test/UnicodeVar.py", line 231, in testFetchOne >> self.failUnlessEqual(self.cursor.fetchone(), self.dataByKey[3]) >> AssertionError: Tuples differ: (3, u'Unicode ? 3', u'Fixed Un... != (3, u'Unicode \u3042 3', u'Fix... >> >> First differing element 1: >> Unicode ? 3 >> Unicode \u3042 3 >> >> - (3, u'Unicode ? 3', u'Fixed Unicode 3 ', u'Nullable 3') >> + (3, >> + u'Unicode \u3042 3', >> + u'Fixed Unicode 3 ', >> + u'Nullable 3') >> >> ---------------------------------------------------------------------- >> Ran 19 tests in 5.071s >> >> >> -----Original Message----- >> From: Anthony Tuininga [mailto:ant...@gm...] >> Sent: Friday, September 02, 2011 6:22 AM >> To: cx-...@li... >> Subject: Re: [cx-oracle-users] ORA-03127 >> >> Ok, I tried with an 11g Release 1 database and was unable to replicate >> this problem. Thanks for the patch but unfortunately what you >> suggested doesn't seem to match the code that I have for 5.1 -- which >> now uses the default character set and simply converts to Unicode as >> needed. I don't think your patch actually helps in this case. :-( I >> checked that the code does what it should for NCLOBs and it seems to >> do so -- with both the default encoding and the UTF8 encoding. I did >> discover, though, that there was nothing in the test suite for NCLOBS >> so I added some tests for that that mirror the ones for CLOB and BLOB. >> I also attempted to call connection.close() deliberately in order to >> see if I could get the same error but I was unable to do so. Could I >> ask you to try the new test suite (don't forget to build the new >> TestNCLOBs table which can be built by running SetupTest.sql in the >> test subdirectory) and let me know if you get the problem with that >> code? That might help determine if this is generically a problem or a >> specific set of queries/commands. Thanks. >> >> Anthony >> >> On Mon, Aug 29, 2011 at 8:15 AM, Mike Elson <Mik...@eu...> wrote: >>> I've also seen this issue. The problem occurs when Django reads from the field SESSION_DATA, type NCLOB, in table DJANGO_SESSION. In cx_Oracle 5.1 the function ExternalLobVar_InternalRead() calls OCILobRead() with csid set to 0, whereas in 5.0.4 csid was set to OCI_UTF16ID when reading NCLOB fields. This causes OCILobRead() to fail but it is not reported at the time, leaving the cursor in an incomplete state and eventually an exception is thrown when the connection is closed. >>> >>> The error doesn't occur when I connect to an Oracle 10 database with NLS_NCHAR_CHARACTERSET of "AL16UTF16" but it does occur with an Oracle 11 database with NLS_NCHAR_CHARACTERSET set to "UTF8". >>> >>> Hope this helps! I put together a small patch (attached) that makes the problem go away but I'm not sure it's the correct fix. >>> >>> Regards, Mike. >>> >>>> Hi, >>>> >>>> I looked at it. The error is referring to the fact that the operations >>>> on the connection are not yet complete. Since it is taking place on a >>>> close() you can simply NOT do the close and allow it to close on its >>>> own when it goes out of scope. There was a change made to >>>> cursor.close() which may affect this but it seems unlikely. It would >>>> be helpful if you can provide a script that demonstrates the problem >>>> so that I can figure out why this might be happening. Thanks. I >>>> certainly have never run into this myself and I am using Django with >>>> cx_Oracle quite heavily. >>>> >>>> Anthony >>>> >>>> 2011/8/25 Sławek Ehlert <slafs.e@...>: >>>> > Hi there! >>>> > >>>> > Can You look at >>>> > >>>> > https://groups.google.com/d/topic/django-users/P9brNKIFwgI/discussion >>>> > >>>> > Recently I saw a similar problem when using cx_Oracle 5.1 when switching >>>> > Django 1.3 (Python 2.6) to another Oracle database (after syncing it) on >>>> > 64bit platform. >>>> > >>>> > Downgrading to 5.0.4 "solved" the problem. >>>> > >>>> > Regards >>>> > >>>> > Sławek >>>> > >>>> > >>>> > ------------------------------------------------------------------------------ >>>> > EMC VNX: the world's simplest storage, starting under $10K >>>> > The only unified storage solution that offers unified management >>>> > Up to 160% more powerful than alternatives and 25% more efficient. >>>> > Guaranteed. http://p.sf.net/sfu/emc-vnx-dev2dev >>>> > _______________________________________________ >>>> > cx-oracle-users mailing list >>>> > cx-oracle-users@... >>>> > https://lists.sourceforge.net/lists/listinfo/cx-oracle-users >>>> > >>>> > >>>> >>> >>> >>> ------------------------------------------------------------------------------ >>> EMC VNX: the world's simplest storage, starting under $10K >>> The only unified storage solution that offers unified management >>> Up to 160% more powerful than alternatives and 25% more efficient. >>> Guaranteed. http://p.sf.net/sfu/emc-vnx-dev2dev >>> _______________________________________________ >>> cx-oracle-users mailing list >>> cx-...@li... >>> https://lists.sourceforge.net/lists/listinfo/cx-oracle-users >>> >>> >> >> ------------------------------------------------------------------------------ >> Special Offer -- Download ArcSight Logger for FREE! >> Finally, a world-class log management solution at an even better >> price-free! And you'll get a free "Love Thy Logs" t-shirt when you >> download Logger. Secure your free ArcSight Logger TODAY! >> http://p.sf.net/sfu/arcsisghtdev2dev >> _______________________________________________ >> cx-oracle-users mailing list >> cx-...@li... >> https://lists.sourceforge.net/lists/listinfo/cx-oracle-users >> ------------------------------------------------------------------------------ >> Special Offer -- Download ArcSight Logger for FREE! >> Finally, a world-class log management solution at an even better >> price-free! And you'll get a free "Love Thy Logs" t-shirt when you >> download Logger. Secure your free ArcSight Logger TODAY! >> http://p.sf.net/sfu/arcsisghtdev2dev >> _______________________________________________ >> cx-oracle-users mailing list >> cx-...@li... >> https://lists.sourceforge.net/lists/listinfo/cx-oracle-users >> > |
From: Robert <web...@gm...> - 2011-09-27 15:57:46
|
Well are you also new to relational database ? SQL ? No, never heard of the book, and judging from the amazon page, i doubt you'll get a "yes" here. Your is a rather odd and vague question. The book has nothing to do w/ Python nor "open source" On 9/26/11 6:35 PM, Robert Lucente wrote: > > I am new to Python and open source. Consequently, I am not sure what the > > appropriate behaviors are. > > > > Have you guys ever heard of the book in the subject line and if so what > did > > you think of it? As a newbie, it seems a good book to at least get a list > of > > things to go think about. > > |