comparison src/main/java/org/monetdb/jdbc/MonetConnection.java @ 906:8c8c423dc619

Older servers don't have clientinfo_properties yet
author Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
date Tue, 18 Jun 2024 10:49:10 +0200 (10 months ago)
parents a52bc2dcdb8c
children e0120c7052bb
comparison
equal deleted inserted replaced
905:a52bc2dcdb8c 906:8c8c423dc619
1346 } 1346 }
1347 1347
1348 private HashMap<String,String> getClientInfoAttributeNames() throws SQLException { 1348 private HashMap<String,String> getClientInfoAttributeNames() throws SQLException {
1349 if (clientInfoAttributeNames == null) { 1349 if (clientInfoAttributeNames == null) {
1350 HashMap<String, String> map = new HashMap<>(); 1350 HashMap<String, String> map = new HashMap<>();
1351 try (Statement st = createStatement(); ResultSet rs = st.executeQuery("SELECT prop, session_attr FROM sys.clientinfo_properties")) { 1351 if (server.canClientInfo()) {
1352 while (rs.next()) { 1352 try (Statement st = createStatement(); ResultSet rs = st.executeQuery("SELECT prop, session_attr FROM sys.clientinfo_properties")) {
1353 String jdbcName = rs.getString(1); 1353 while (rs.next()) {
1354 String attrName = rs.getString(2); 1354 String jdbcName = rs.getString(1);
1355 map.put(jdbcName, attrName); 1355 String attrName = rs.getString(2);
1356 map.put(jdbcName, attrName);
1357 }
1356 } 1358 }
1357 } 1359 }
1358 clientInfoAttributeNames = map; 1360 clientInfoAttributeNames = map;
1359 } 1361 }
1360 return clientInfoAttributeNames; 1362 return clientInfoAttributeNames;