@Override public void setClientInfo(String name, String value) throws SQLClientInfoException { if (holder == null) { throw new SQLClientInfoException(); } conn.setClientInfo(name, value); }
@Override public void setClientInfo(Properties properties) throws SQLClientInfoException { if (holder == null) { throw new SQLClientInfoException(); } conn.setClientInfo(properties); }
/** {@inheritDoc} */ @Override public void setClientInfo(String name, String val) throws SQLClientInfoException { if (closed) throw new SQLClientInfoException("Connection is closed.", null); }
/** {@inheritDoc} */ @Override public void setClientInfo(Properties props) throws SQLClientInfoException { if (closed) throw new SQLClientInfoException("Connection is closed.", null); }
public void setClientInfo(String name, String value) throws SQLClientInfoException { throw new SQLClientInfoException(); }
/** * [Not supported] Get the client properties. */ // ## Java 1.6 ## @Override public Properties getClientInfo() throws SQLClientInfoException { throw new SQLClientInfoException(); }
/** * [Not supported] Set a client property. */ // ## Java 1.6 ## @Override public void setClientInfo(String name, String value) throws SQLClientInfoException { throw new SQLClientInfoException(); }
/** * [Not supported] Set the client properties. */ // ## Java 1.6 ## @Override public void setClientInfo(Properties properties) throws SQLClientInfoException { throw new SQLClientInfoException(); }
public void setClientInfo(Properties prop) throws SQLClientInfoException { throw new SQLClientInfoException(); }
private static SQLClientInfoException convertToClientInfoException( SQLException x) { if (x instanceof SQLClientInfoException) { return (SQLClientInfoException) x; } return new SQLClientInfoException(x.getMessage(), x.getSQLState(), x.getErrorCode(), null, null); }
@Override public void setClientInfo(String name, String value) throws SQLClientInfoException { try { checkOpen(); } catch (AlreadyClosedSqlException e) { throw new SQLClientInfoException(e.getMessage(), null, e); } try { super.setClientInfo(name, value); } catch (UnsupportedOperationException e) { SQLFeatureNotSupportedException intended = new SQLFeatureNotSupportedException(e.getMessage(), e); throw new SQLClientInfoException(e.getMessage(), null, intended); } }
@Override public void setClientInfo(Properties properties) throws SQLClientInfoException { try { checkOpen(); } catch (AlreadyClosedSqlException e) { throw new SQLClientInfoException(e.getMessage(), null, e); } try { super.setClientInfo(properties); } catch (UnsupportedOperationException e) { SQLFeatureNotSupportedException intended = new SQLFeatureNotSupportedException(e.getMessage(), e); throw new SQLClientInfoException(e.getMessage(), null, intended); } }
private void sendClientInfo() throws SQLClientInfoException { TSetClientInfoReq req = new TSetClientInfoReq(sessHandle); Map<String, String> map = new HashMap<>(); if (clientInfo != null) { for (Entry<Object, Object> e : clientInfo.entrySet()) { if (e.getKey() == null || e.getValue() == null) continue; map.put(e.getKey().toString(), e.getValue().toString()); } } req.setConfiguration(map); try { TSetClientInfoResp openResp = client.SetClientInfo(req); Utils.verifySuccess(openResp.getStatus()); } catch (TException | SQLException e) { LOG.error("Error sending client info", e); throw new SQLClientInfoException("Error sending client info", null, e); } }
public void setClientInfo(Properties properties) throws SQLClientInfoException { if (properties == null || properties.size() == 0) return; Map<String, ClientInfoStatus> failures = new HashMap<String, ClientInfoStatus>(); Iterator<String> i = properties.stringPropertyNames().iterator(); while (i.hasNext()) { String name = i.next(); if (haveMinimumServerVersion("9.0") && "ApplicationName".equals(name)) { String value = properties.getProperty(name); setClientInfo(name, value); } else { failures.put(i.next(), ClientInfoStatus.REASON_UNKNOWN_PROPERTY); } } if (!failures.isEmpty()) throw new SQLClientInfoException(GT.tr("ClientInfo property not supported."), PSQLState.NOT_IMPLEMENTED.getState(), failures); }
@Override public void setClientInfo(Properties properties) throws SQLClientInfoException { try { checkClosed(); } catch (final SQLException cause) { Map<String, ClientInfoStatus> failures = new HashMap<String, ClientInfoStatus>(); for (Map.Entry<Object, Object> e : properties.entrySet()) { failures.put((String) e.getKey(), ClientInfoStatus.REASON_UNKNOWN); } throw new SQLClientInfoException(GT.tr("This connection has been closed."), failures, cause); } Map<String, ClientInfoStatus> failures = new HashMap<String, ClientInfoStatus>(); for (String name : new String[]{"ApplicationName"}) { try { setClientInfo(name, properties.getProperty(name, null)); } catch (SQLClientInfoException e) { failures.putAll(e.getFailedProperties()); } } if (!failures.isEmpty()) { throw new SQLClientInfoException(GT.tr("One or more ClientInfo failed."), PSQLState.NOT_IMPLEMENTED.getState(), failures); } }
public void setClientInfo(String name, String value) throws SQLClientInfoException { if (haveMinimumServerVersion("9.0") && "ApplicationName".equals(name)) { if (value == null) value = ""; try { StringBuffer sql = new StringBuffer("SET application_name = '"); Utils.appendEscapedLiteral(sql, value, getStandardConformingStrings()); sql.append("'"); execSQLUpdate(sql.toString()); } catch (SQLException sqle) { Map<String, ClientInfoStatus> failures = new HashMap<String, ClientInfoStatus>(); failures.put(name, ClientInfoStatus.REASON_UNKNOWN); throw new SQLClientInfoException(GT.tr("Failed to set ClientInfo property: {0}", "ApplicationName"), sqle.getSQLState(), failures, sqle); } _clientInfo.put(name, value); return; } Map<String, ClientInfoStatus> failures = new HashMap<String, ClientInfoStatus>(); failures.put(name, ClientInfoStatus.REASON_UNKNOWN_PROPERTY); throw new SQLClientInfoException(GT.tr("ClientInfo property not supported."), PSQLState.NOT_IMPLEMENTED.getState(), failures); }
Map<String, ClientInfoStatus> failures = new HashMap<String, ClientInfoStatus>(); failures.put(name, ClientInfoStatus.REASON_UNKNOWN); throw new SQLClientInfoException(GT.tr("This connection has been closed."), failures, cause); Map<String, ClientInfoStatus> failures = new HashMap<String, ClientInfoStatus>(); failures.put(name, ClientInfoStatus.REASON_UNKNOWN); throw new SQLClientInfoException( GT.tr("Failed to set ClientInfo property: {0}", "ApplicationName"), sqle.getSQLState(), failures, sqle);
throw new SQLClientInfoException( "Property name '" + name + " is used internally by H2.", Collections.<String, ClientInfoStatus> emptyMap()); throw new SQLClientInfoException( "Client info name '" + name + "' not supported.", Collections.<String, ClientInfoStatus> emptyMap());
@Override public void setClientInfo(Properties properties) throws SQLClientInfoException { if (holder == null) { throw new SQLClientInfoException(); } conn.setClientInfo(properties); }
@Override public void setClientInfo(String name, String value) throws SQLClientInfoException { if (holder == null) { throw new SQLClientInfoException(); } conn.setClientInfo(name, value); }