using the arrow flight sql JDBC driver yields mixed results for me. The crux of my issue seems to be that wile PreparedStatement.executeQuery() works fine, its sibling PreparedStatement.executeUpdate() doesn’t. The job appears in the Dremio UI, but then the job fails with a “(java.lang.IllegalStateException) Tenant context should not be null” from the Nessie layers. Same JDBC connection, same SQL query (an INSERT INTO in this case).
Is there something special to put in the JDBC URL or in the connection settings to get this to work?
Can you get us a small java snippet that triggers the issue? I tried with the following and it didn’t seem to reproduce:
// Step 1: CREATE TABLE using executeUpdate()
// This also triggers the "Tenant context should not be null" error from Nessie layers
String createTableQuery = "CREATE TABLE IF NOT EXISTS " + FULL_SCHEMA_PATH + ".test_table (id INT, name VARCHAR)";
try (PreparedStatement pstmt = conn.prepareStatement(createTableQuery)) {
System.out.println("Executing CREATE TABLE: " + createTableQuery);
int result = pstmt.executeUpdate();
System.out.println("[SUCCESS] CREATE TABLE succeeded with result: " + result);
} catch (SQLException e) {
System.err.println("[EXPECTED ERROR] CREATE TABLE failed:");
printSqlException(e);
if (containsTenantContextError(e)) {
System.out.println();
System.out.println(">>> CONFIRMED: This is the 'Tenant context should not be null' error <<<");
System.out.println(">>> from the Nessie layers as described in the forum post. <<<");
}
// Return early since INSERT will also fail if CREATE TABLE failed
System.out.println();
return;
}
System.out.println();
// Step 2: INSERT using executeUpdate()
// This also triggers the "Tenant context should not be null" error from Nessie layers
String insertQuery = "INSERT INTO " + FULL_SCHEMA_PATH + ".test_table (id, name) VALUES (1, 'test')";
try (PreparedStatement pstmt = conn.prepareStatement(insertQuery)) {
System.out.println("Executing INSERT: " + insertQuery);
int result = pstmt.executeUpdate();
System.out.println("[SUCCESS] INSERT succeeded with result: " + result);
} catch (SQLException e) {
System.err.println("[EXPECTED ERROR] INSERT failed:");
printSqlException(e);
// Check if it's the specific error from the forum post
if (containsTenantContextError(e)) {
System.out.println();
System.out.println(">>> CONFIRMED: This is the 'Tenant context should not be null' error <<<");
System.out.println(">>> from the Nessie layers as described in the forum post. <<<");
}
// Return early since INSERT INTO SELECT will also fail
System.out.println();
return;
}