Issue1733044

classification
Title: zxJDBC ClassCastException when getting cursor
Type: Severity: normal
Components: Library Versions:
Milestone:
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: fwierzbicki, r_walter
Priority: normal Keywords:

Created on 2007-06-07.20:19:37 by r_walter, last changed 2007-06-07.20:19:37 by r_walter.

Files
File name Uploaded Description Edit Remove
database_access.py r_walter, 2007-06-07.20:19:37 test program for accessing a database
Messages
msg1626 (view) Author: Roland Walter (r_walter) Date: 2007-06-07.20:19:37
Hello,

I used jython 2.2b2 for accessing a postgresql database with the actual driver build 505. I tried the same with a firebird database. In both cases i got the error:

java.lang.ClassCastException: java.lang.ClassCastException: org.python.core.PyNone cannot be cast to com.ziclix.python.sql.PyConnection

when getting a cursor from the database connection. The example program used is below. The same program worked when using jython 2.1.

# test access on database
from com.ziclix.python.sql import zxJDBC

database="jdbc:postgresql://dios/standarddb"
user="amarok"
password="xxxx"
driver="org.postgresql.Driver"

db = zxJDBC.connect(database, user, password, driver)

curs = db.cursor()

curs.execute("select count(*) from album")

curs.description

for a in curs.fetchall():
    print a

curs.close()
db.close()


The full error is (line 11 is 'curs=db.cursor()'):

Traceback (innermost last):
  File "database_access.py", line 11, in ?
java.lang.ClassCastException: org.python.core.PyNone cannot be cast to com.ziclix.python.sql.PyConnection
        at com.ziclix.python.sql.ConnectionFunc.__call__(Unknown Source)
        at org.python.core.PyObject.invoke(Unknown Source)
        at org.python.pycode._pyx0.f$0(database_access.py:11)
        at org.python.pycode._pyx0.call_function(database_access.py)
        at org.python.core.PyTableCode.call(Unknown Source)
        at org.python.core.PyCode.call(Unknown Source)
        at org.python.core.Py.runCode(Unknown Source)
        at org.python.core.__builtin__.execfile_flags(Unknown Source)
        at org.python.util.PythonInterpreter.execfile(Unknown Source)
        at org.python.util.jython.main(Unknown Source)

java.lang.ClassCastException: java.lang.ClassCastException: org.python.core.PyNone cannot be cast to com.ziclix.python.sql.PyConnection

msg1627 (view) Author: Frank Wierzbicki (fwierzbicki) Date: 2007-06-07.20:27:07
This is fixed on the trunk, but has not yet made it into an official release.
History
Date User Action Args
2007-06-07 20:19:37r_waltercreate