Selecting ROWIDs errors out on fetch.

Bug #684909 reported by Adam Buchbinder
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
JayDeBeApi
Fix Released
Medium
Bastian

Bug Description

Fetching a ROWID from an Oracle table (I'm using Oracle's JDBC jar, "ojdbc6.jar") errors out, as there's no function to print it. I'm connecting to an Oracle 10g 10.2 database, if that matters, using JayDeBeApi 0.1.

>>> curs.execute('select im_id, int_method, rowid from interview_method')
>>> curs.description
[(u'IM_ID', u'NUMBER', 22, 22, 12, 0, 0), (u'INT_METHOD', u'VARCHAR2', 50, 50, 50, 0, 1), (u'ROWID', u'ROWID', 1, 1, 0, 0, 0)]
>>> curs.fetchall()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "jaydebeapi/dbapi2.py", line 282, in fetchall
    row = self.fetchone()
  File "jaydebeapi/dbapi2.py", line 254, in fetchone
    getter = getattr(self._rs, 'get%s' % METHOD_MAP[sqltype])
KeyError: -8

Bastian (baztian)
Changed in jaydebeapi:
assignee: nobody → Bastian (baztian)
importance: Undecided → Medium
Revision history for this message
Bastian (baztian) wrote :

The type ROWID seems to be new in Java 1.6 (http://download.oracle.com/javase/6/docs/api/constant-values.html#java.sql). Should provide more mappings and a default behaviour so there won't be any problems when new constants are added to java.sql.Types.

Revision history for this message
Bastian (baztian) wrote :

Fixed in revision 5. Could you please be so kind to check out the latest version of the trunk (or simply replace your dbapi2.py with the one from trunk) and report back if it works for you. I'm not using Oracle...

Changed in jaydebeapi:
status: New → In Progress
status: In Progress → Fix Committed
Revision history for this message
Adam Buchbinder (adam-buchbinder) wrote :

It appears to work; no exceptions here:

>>> curs.execute('select im_id, int_method, rowid from interview_method')
>>> curs.description
[(u'IM_ID', u'NUMBER', 22, 22, 12, 0, 0), (u'INT_METHOD', u'VARCHAR2', 50, 50, 50, 0, 1), (u'ROWID', u'ROWID', 1, 1, 0, 0, 0)]
>>> r = curs.fetchone()
>>> r
(1.0, u'Telephone', <jpype._jclass.oracle.sql.ROWID object at 0x7fb6bc3670d0>)
>>> r[2].stringValue()
u'AAAPh4AAFAAAAAsAAA'

Thanks!

Bastian (baztian)
Changed in jaydebeapi:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.