comparison src/main/java/org/monetdb/jdbc/MonetConnection.java @ 879:6e8ff2818fa7

Implement the new schema= option of the jdbc URL
author Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
date Wed, 28 Feb 2024 13:37:36 +0100 (14 months ago)
parents dc33533e6468
children 778959b2e0a4
comparison
equal deleted inserted replaced
878:dc33533e6468 879:6e8ff2818fa7
222 sqle.setNextException(new SQLNonTransientConnectionException(connex[1], "08001")); 222 sqle.setNextException(new SQLNonTransientConnectionException(connex[1], "08001"));
223 } 223 }
224 throw sqle; 224 throw sqle;
225 } 225 }
226 226
227 // Now take care of any handshake options not handled during the handshake 227 // Now take care of any options not handled during the handshake
228 curReplySize = defaultFetchSize; 228 curReplySize = defaultFetchSize;
229 if (lang == LANG_SQL) { 229 if (lang == LANG_SQL) {
230 if (autoCommit != target.isAutocommit()) { 230 if (autoCommit != target.isAutocommit()) {
231 setAutoCommit(target.isAutocommit()); 231 setAutoCommit(target.isAutocommit());
232 } 232 }
238 } 238 }
239 } 239 }
240 240
241 // we're absolutely not closed, since we're brand new 241 // we're absolutely not closed, since we're brand new
242 closed = false; 242 closed = false;
243
244 if (!target.getSchema().isEmpty()) {
245 try (Statement stmt = this.createStatement()) {
246 String escaped = target.getSchema().replaceAll("\"", "\"\"");
247 stmt.execute("SET SCHEMA \"" + escaped + "\"");
248 }
249 }
243 } 250 }
244 251
245 //== methods of interface Connection 252 //== methods of interface Connection
246 253
247 /** 254 /**