Re: [cx-oracle-users] ORA-03127
Brought to you by:
atuining
From: Anthony T. <ant...@gm...> - 2011-09-05 13:44:38
|
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 > |