Search in sources :

Example 1 with PgConnection

use of org.postgresql.jdbc.PgConnection in project com.revolsys.open by revolsys.

the class PostgreSQLRecordStore method getJdbcConnection.

@Override
public JdbcConnection getJdbcConnection(final boolean autoCommit) {
    final DataSource dataSource = getDataSource();
    final Connection connection = JdbcUtils.getConnection(dataSource);
    try {
        final PgConnection pgConnection = connection.unwrap(PgConnection.class);
        pgConnection.addDataType("geometry", PostgreSQLGeometryWrapper.class);
        pgConnection.addDataType("box2d", PostgreSQLBoundingBoxWrapper.class);
        pgConnection.addDataType("box3d", PostgreSQLBoundingBoxWrapper.class);
        pgConnection.addDataType("tid", PostgreSQLTidWrapper.class);
    } catch (final SQLException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    return new JdbcConnection(connection, dataSource, autoCommit);
}
Also used : SQLException(java.sql.SQLException) Connection(java.sql.Connection) JdbcConnection(com.revolsys.jdbc.JdbcConnection) PgConnection(org.postgresql.jdbc.PgConnection) PgConnection(org.postgresql.jdbc.PgConnection) JdbcConnection(com.revolsys.jdbc.JdbcConnection) DataSource(javax.sql.DataSource)

Aggregations

JdbcConnection (com.revolsys.jdbc.JdbcConnection)1 Connection (java.sql.Connection)1 SQLException (java.sql.SQLException)1 DataSource (javax.sql.DataSource)1 PgConnection (org.postgresql.jdbc.PgConnection)1