Hi,
as far as I can see from the source code, driver's fallback isolation level if not properly resolved from db is TRANSACTION_READ_COMMITTED. Code snippets from ConnectionImpl:
{code}
/** isolation level */
private int isolationLevel = java.sql.Connection.TRANSACTION_READ_COMMITTED;
public synchronized int getTransactionIsolation() throws SQLException {
....
if (versionMeetsMinimum(4, 0, 3)) {
query = "SELECT @@session.tx_isolation";
offset = 1;
} else {
query = "SHOW VARIABLES LIKE 'transaction_isolation'";
offset = 2;
}
....
{code}
However I am curious and confused about this method within DatabaseMetaData.java:
{code}
/**
* What's the database's default transaction isolation level? The values are
* defined in java.sql.Connection.
*
* @return the default isolation level
* @throws SQLException
* if a database access error occurs
* @see Connection
*/
public int getDefaultTransactionIsolation() throws SQLException {
if (this.conn.supportsIsolationLevel()) {
return java.sql.Connection.TRANSACTION_READ_COMMITTED;
}
return java.sql.Connection.TRANSACTION_NONE;
}
{code}
Shoudn't this return the database's default since it has been resolved? Why is it hardcoded? Maybe you mean the driver's default if it cannot be resolved from the db, as implemented in ConnectionImpl.java? Maybe the method documentation is wrong?
Thanks in advance!
as far as I can see from the source code, driver's fallback isolation level if not properly resolved from db is TRANSACTION_READ_COMMITTED. Code snippets from ConnectionImpl:
{code}
/** isolation level */
private int isolationLevel = java.sql.Connection.TRANSACTION_READ_COMMITTED;
public synchronized int getTransactionIsolation() throws SQLException {
....
if (versionMeetsMinimum(4, 0, 3)) {
query = "SELECT @@session.tx_isolation";
offset = 1;
} else {
query = "SHOW VARIABLES LIKE 'transaction_isolation'";
offset = 2;
}
....
{code}
However I am curious and confused about this method within DatabaseMetaData.java:
{code}
/**
* What's the database's default transaction isolation level? The values are
* defined in java.sql.Connection.
*
* @return the default isolation level
* @throws SQLException
* if a database access error occurs
* @see Connection
*/
public int getDefaultTransactionIsolation() throws SQLException {
if (this.conn.supportsIsolationLevel()) {
return java.sql.Connection.TRANSACTION_READ_COMMITTED;
}
return java.sql.Connection.TRANSACTION_NONE;
}
{code}
Shoudn't this return the database's default since it has been resolved? Why is it hardcoded? Maybe you mean the driver's default if it cannot be resolved from the db, as implemented in ConnectionImpl.java? Maybe the method documentation is wrong?
Thanks in advance!