Open paulhanke opened 3 years ago
Let's see if JPype is buggy on this one.
By default autocommit must be off if transactions supported according to the PEP.
https://www.python.org/dev/peps/pep-0249/#commit
The Java documentation states the three conditions for throwing an exception.
https://docs.oracle.com/javase/7/docs/api/java/sql/Connection.html
SQLException - if a database access error occurs, setAutoCommit(true) is called while participating in a distributed transaction, or this method is called on a closed connection
This isn't an access error, we are not participating in a distributed transaction, and the connection is not closed. So at least according to the documentation I would not expect SQLFeatureNotSupportException. If it is acceptable (due to some other documentation) then according to the PEP we would have to add a try/except block on lines 456 and 639 in jpype.dbapi2 as the operation must be a void if not supported.
Thus I would guess this is indeed a drill bug.
Drill JDBC driver 1.18.0 Anaconda3 (Jupyter)
~/anaconda3/lib/python3.7/site-packages/jpype/dbapi2.py in init(self, jconnection, adapters, converters, setters, getters) 454 # https://www.python.org/dev/peps/pep-0249/#commit --> 455 self._jcx.setAutoCommit(False) 456
java.sql.SQLFeatureNotSupportedException: java.sql.SQLFeatureNotSupportedException: Can't turn off auto-committing; transactions are not supported. (Drill is not transactional.)
Comment out line 455 in dbapi2.py, and everything works fine.