- Common ways to obtain PgConnection
private void myMethod () {PgConnection p =
Connection connection;connection.unwrap(PgConnection.class)
- Smart code suggestions by Codota
}
private Charset determineDatabaseCharset() { try { return Charset.forName(((PgConnection) connection()).getEncoding().name()); } catch (SQLException e) { throw new RuntimeException("Couldn't obtain encoding for database " + database(), e); } }
@Override public byte[] encodeString(String str) throws SQLException { try { return getEncoding().encode(str); } catch (IOException ioe) { throw new PSQLException(GT.tr("Unable to translate data into the desired encoding."), PSQLState.DATA_ERROR, ioe); } }
private Charset determineDatabaseCharset() { try { return Charset.forName(((PgConnection) connection()).getEncoding().name()); } catch (SQLException e) { throw new RuntimeException("Couldn't obtain encoding for database " + database(), e); } }