{"record":{"id":"0c94e5bec4787dc9","repo":"prestodb/presto","slug":"invalid-transaction-isolation-level","errorCode":null,"errorMessage":"Invalid transaction isolation level: ","messagePattern":"Invalid transaction isolation level: ","errorType":"validation","errorClass":"SQLException","httpStatus":null,"severity":"error","filePath":"presto-jdbc/src/main/java/com/facebook/presto/jdbc/PrestoConnection.java","lineNumber":922,"sourceCode":"        if (resultSetHoldability != ResultSet.HOLD_CURSORS_OVER_COMMIT) {\n            throw new SQLFeatureNotSupportedException(\"Result set holdability must be HOLD_CURSORS_OVER_COMMIT\");\n        }\n    }\n\n    private static String getIsolationLevel(int level)\n            throws SQLException\n    {\n        switch (level) {\n            case TRANSACTION_READ_UNCOMMITTED:\n                return \"READ UNCOMMITTED\";\n            case TRANSACTION_READ_COMMITTED:\n                return \"READ COMMITTED\";\n            case TRANSACTION_REPEATABLE_READ:\n                return \"REPEATABLE READ\";\n            case TRANSACTION_SERIALIZABLE:\n                return \"SERIALIZABLE\";\n        }\n        throw new SQLException(\"Invalid transaction isolation level: \" + level);\n    }\n}\n","sourceCodeStart":904,"sourceCodeEnd":925,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-jdbc/src/main/java/com/facebook/presto/jdbc/PrestoConnection.java#L904-L925","documentation":"PrestoConnection.getIsolationLevel() throws this SQLException when setTransactionIsolation(level) is called with an integer that is not one of TRANSACTION_READ_UNCOMMITTED, TRANSACTION_READ_COMMITTED, TRANSACTION_REPEATABLE_READ, or TRANSACTION_SERIALIZABLE. It is an argument-validation guard mapping the level constant to its Presto session name; unknown values cannot be mapped.","triggerScenarios":"setTransactionIsolation(0) or any nonstandard int (e.g. 5, vendor-specific constants from another driver); passing TRANSACTION_NONE; passing a level read from config as a raw string parsed to int.","commonSituations":"Using another database's isolation-level constant (e.g. SQL Server snapshot constants); config files storing level names instead of JDBC int constants; JDBC 4.x drivers exposing TRANSACTION_SNAPSHOT which Presto lacks.","solutions":["Pass only the standard java.sql.Connection TRANSACTION_* constants (1-4)","Remove TRANSACTION_NONE (0) / vendor-specific values from configuration","If config holds names, map them: \"READ_COMMITTED\" -> Connection.TRANSACTION_READ_COMMITTED"],"exampleFix":"// before\nconn.setTransactionIsolation(5); // vendor constant\n// after\nconn.setTransactionIsolation(Connection.TRANSACTION_READ_COMMITTED);","handlingStrategy":"validation","validationCode":"int level = Integer.parseInt(cfg.get(\"isolation\"));\nif (level != Connection.TRANSACTION_READ_UNCOMMITTED\n        && level != Connection.TRANSACTION_READ_COMMITTED\n        && level != Connection.TRANSACTION_REPEATABLE_READ\n        && level != Connection.TRANSACTION_SERIALIZABLE) {\n    throw new IllegalArgumentException(\"Unsupported isolation level: \" + level);\n}\nconn.setTransactionIsolation(level);","typeGuard":null,"tryCatchPattern":"try {\n    conn.setTransactionIsolation(level);\n} catch (SQLException e) {\n    if (e.getMessage() != null && e.getMessage().startsWith(\"Invalid transaction isolation level\")) {\n        conn.setTransactionIsolation(Connection.TRANSACTION_READ_COMMITTED);\n    } else {\n        throw e;\n    }\n}","preventionTips":["Only pass java.sql.Connection TRANSACTION_* constants","Reject TRANSACTION_NONE and vendor-specific ints in config parsing","Map human-readable names in config to JDBC constants explicitly"],"tags":["jdbc","argument-validation","transactions","presto"],"backgroundTag":"invalid-argument-value","analyzedSha":"55bb57d202de3b926896fa966c2c4a44c779634e","analyzedAt":"2026-09-04T12:50:26.162Z","contentChangedAt":"2026-09-04T12:50:26.162Z","schemaVersion":2},"datasetVersion":"2026-09-11T21:17:09.523Z"}