jython and java exceptions
Alan Kennedy
alanmk at hotmail.com
Wed Aug 11 08:10:42 EDT 2004
[Jan Gregor]
> I tried it again with SQLException only but my main loop ends with
> uncatched com.sybase.jdbc2.jdbc.SybSQLException.
Strange indeed. The only explanation I can think of offhand for the
exception not being caught is if com.sybase.jdbc2.jdbc.SybSQLException
is not a subclass of java.sql.SQLException.
Unfortunately, I can't seem to find the javadoc for the Sybase JDBC
driver online (which is poor performance from Sybase).
Try code of the following form to see what the nature of the exception is
import java.lang.Exception
import java.sql.SQLException
try:
# Insert your exception generating code here
except java.lang.Exception, jlx: # Catch every possible java exception
if isinstance(jlx, java.sql.SQLException):
print "Exc %s is subclass of java.sql.SQLException" % jlx.toString()
else:
print "Exc %s != subclass of java.sql.SQLException!" % jlx.toString()
Run that and let us know what the output is.
--
alan kennedy
------------------------------------------------------
email alan: http://xhaus.com/contact/alan
More information about the Python-list
mailing list