MBTilesFile(JDBCDataStore dataStore) { this.dataStore = dataStore; this.connPool = dataStore.getDataSource(); }
GeoPackage(JDBCDataStore dataStore) { this.dataStore = dataStore; this.connPool = dataStore.getDataSource(); }
private void setIsLimitOffsetSupported() { Connection con = null; PreparedStatement ps = null; ResultSet rs = null; try { con = dataStore.getDataSource().getConnection(); ps = con.prepareStatement(SELECT_LIMITOFFSET); rs = ps.executeQuery(); if (rs.next()) isLimitOffsetSupported = Boolean.TRUE; LOGGER.info(LIMITOFFSET_MESSAGE); } catch (SQLException ex) { isLimitOffsetSupported = Boolean.FALSE; } finally { try { if (rs != null) rs.close(); } catch (SQLException ex1) { } try { if (ps != null) ps.close(); } catch (SQLException ex1) { } try { if (con != null) con.close(); } catch (SQLException ex1) { } } }
private void setIsRowNumberSupported() { Connection con = null; PreparedStatement ps = null; ResultSet rs = null; try { con = dataStore.getDataSource().getConnection(); ps = con.prepareStatement(SELECT_ROWNUMBER); rs = ps.executeQuery(); if (rs.next()) isRowNumberSupported = Boolean.TRUE; LOGGER.info(ROWNUMBER_MESSAGE); } catch (SQLException ex) { isRowNumberSupported = Boolean.FALSE; } finally { try { if (rs != null) rs.close(); } catch (SQLException ex1) { } try { if (ps != null) ps.close(); } catch (SQLException ex1) { } try { if (con != null) con.close(); } catch (SQLException ex1) { } } }
/** * Creates a new connection. * * <p>Callers of this method should close the connection when done with it. . */ protected final Connection createConnection() { try { LOGGER.fine("CREATE CONNECTION"); Connection cx = getDataSource().getConnection(); // isolation level is not set in the datastore, see // http://jira.codehaus.org/browse/GEOT-2021 // call dialect callback to initialize the connection dialect.initializeConnection(cx); // if there is any lifecycle listener use it if (connectionLifecycleListeners.size() > 0) { List<ConnectionLifecycleListener> locals = new ArrayList<ConnectionLifecycleListener>(connectionLifecycleListeners); cx = new LifecycleConnection(this, cx, locals); } return cx; } catch (SQLException e) { throw new RuntimeException("Unable to obtain connection: " + e.getMessage(), e); } }
Connection con = null; try { con = dataStore.getDataSource().getConnection(); int major = con.getMetaData().getDatabaseMajorVersion(); int minor = con.getMetaData().getDatabaseMinorVersion();
@Override public void initializeConnection(Connection cx) throws SQLException { new MBTilesFile(dataStore.getDataSource()).init(cx); }
Connection con = null; try { con = dataStore.getDataSource().getConnection(); DB2DialectInfo di = ((DB2SQLDialectPrepared) dataStore.getSQLDialect()).getDb2DialectInfo();
public void testJNDIDataSource() throws Exception { ((JDBCJNDITestSetup) setup).setupJNDIEnvironment(getDataStoreFactory()); HashMap params = new HashMap(); String dbtype = setup.createDataStoreFactory().getDatabaseID(); params.put(JDBCDataStoreFactory.NAMESPACE.key, "http://www.geotools.org/test"); params.put(JDBCDataStoreFactory.DBTYPE.key, dbtype); params.put(JDBCJNDIDataStoreFactory.JNDI_REFNAME.key, "ds"); JDBCDataStore dataStore = null; try { dataStore = (JDBCDataStore) DataStoreFinder.getDataStore(params); try (Connection con = dataStore.getDataSource().getConnection()) { assertTrue(con != null); assertFalse(con.isClosed()); } } finally { if (dataStore != null) { dataStore.dispose(); } } }
GeoPackage(JDBCDataStore dataStore) { this.dataStore = dataStore; this.connPool = dataStore.getDataSource(); }
MBTilesFile(JDBCDataStore dataStore) { this.dataStore = dataStore; this.connPool = dataStore.getDataSource(); }
if (result.getDataSource() == null) { throw new IOException("JDBC Connection not available with provided parameters");
private void setIsLimitOffsetSupported() { Connection con = null; PreparedStatement ps = null; ResultSet rs = null; try { con = dataStore.getDataSource().getConnection(); ps = con.prepareStatement(SELECT_LIMITOFFSET); rs = ps.executeQuery(); if (rs.next()) isLimitOffsetSupported=Boolean.TRUE; } catch (SQLException ex) { LOGGER.warning(LIMITOFFSET_MESSAGE); isLimitOffsetSupported=Boolean.FALSE; } finally { try {if (rs!=null) rs.close(); } catch (SQLException ex1) {}; try {if (ps!=null) ps.close();} catch (SQLException ex1) {}; try {if (con!=null) con.close();} catch (SQLException ex1) {}; } }
try (Connection conn = dataStore.getDataSource().getConnection()) {
private void setIsRowNumberSupported() { Connection con = null; PreparedStatement ps = null; ResultSet rs = null; try { con = dataStore.getDataSource().getConnection(); ps = con.prepareStatement(SELECT_ROWNUMBER); rs = ps.executeQuery(); if (rs.next()) isRowNumberSupported=Boolean.TRUE; } catch (SQLException ex) { LOGGER.warning(ROWNUMBER_MESSAGE); isRowNumberSupported=Boolean.FALSE; } finally { try {if (rs!=null) rs.close(); } catch (SQLException ex1) {}; try {if (ps!=null) ps.close();} catch (SQLException ex1) {}; try {if (con!=null) con.close();} catch (SQLException ex1) {}; } }
/** * Creates a new connection. * <p> * Callers of this method should close the connection when done with it. * </p>. * */ protected final Connection createConnection() { try { LOGGER.fine( "CREATE CONNECTION"); Connection cx = getDataSource().getConnection(); // isolation level is not set in the datastore, see // http://jira.codehaus.org/browse/GEOT-2021 //call dialect callback to iniitalie the connection dialect.initializeConnection( cx ); return cx; } catch (SQLException e) { throw new RuntimeException("Unable to obtain connection", e); } }
/** * Creates a new connection. * <p> * Callers of this method should close the connection when done with it. * </p>. * */ protected final Connection createConnection() { try { LOGGER.fine( "CREATE CONNECTION"); if( getDataSource() == null ){ throw new NullPointerException("JDBC DataSource not available after dispose() has been called"); } Connection cx = getDataSource().getConnection(); // isolation level is not set in the datastore, see // http://jira.codehaus.org/browse/GEOT-2021 //call dialect callback to initialize the connection dialect.initializeConnection( cx ); // if there is any lifecycle listener use it if(connectionLifecycleListeners.size() > 0) { List<ConnectionLifecycleListener> locals = new ArrayList<ConnectionLifecycleListener>(connectionLifecycleListeners); cx = new LifecycleConnection(this, cx, locals); } return cx; } catch (SQLException e) { throw new RuntimeException("Unable to obtain connection: " + e.getMessage(), e); } }
public void optimize() throws DaoException { // Hack: wrap the datasource in a WpDataSource to access the helper method. // We don't close the WpDataSource because it doesn't own the connection. WpDataSource src = new WpDataSource(store.getDataSource()); src.optimize(SPATIAL_DB_NAME); }
@Override public void initializeConnection(Connection cx) throws SQLException { new MBTilesFile(dataStore.getDataSource()).init(cx); }
public void optimize() throws DaoException { // Hack: wrap the datasource in a WpDataSource to access the helper method. // We don't close the WpDataSource because it doesn't own the connection. WpDataSource src = new WpDataSource(store.getDataSource()); src.optimize(SPATIAL_DB_NAME); }