Package org.geotools.jdbc

Examples of org.geotools.jdbc.JDBCDataStore


    private void clearTable(PostGisConfig cfg, String table) throws PostGisException, IOException, SQLException {
        DataStore ds_ = PostGISUtils.createDatastore(cfg);
        assertTrue(ds_ instanceof JDBCDataStore);
       
        JDBCDataStore ds= (JDBCDataStore) ds_;
        Connection connection = ds.getConnection(Transaction.AUTO_COMMIT);
        connection.commit();
        Statement statement = connection.createStatement();
        statement.executeUpdate("DROP TABLE IF EXISTS " + cfg.getSchema() + "." + table );
        connection.commit();
        ds.dispose();
    }
View Full Code Here


    private long count(PostGisConfig cfg, String table) throws PostGisException, IOException, SQLException {
        DataStore ds_ = PostGISUtils.createDatastore(cfg);
        assertTrue(ds_ instanceof JDBCDataStore);
       
        JDBCDataStore ds= (JDBCDataStore) ds_;

        Connection connection = ds.getConnection(Transaction.AUTO_COMMIT);
        connection.commit();
        Statement statement = connection.createStatement();
        ResultSet rs = statement.executeQuery("SELECT count(*) FROM " + cfg.getSchema() + "." + table );
        rs.next();
        long ret = rs.getLong(1);
        ds.dispose();
        return ret;
    }
View Full Code Here

    private void clearTable(PostGisConfig cfg, String table) throws PostGisException, IOException, SQLException {
        DataStore ds_ = PostGISUtils.createDatastore(cfg);
        assertTrue(ds_ instanceof JDBCDataStore);
       
        JDBCDataStore ds= (JDBCDataStore) ds_;

        Connection connection = ds.getConnection(Transaction.AUTO_COMMIT);
        connection.commit();
        Statement statement = connection.createStatement();
        statement.executeUpdate("DROP TABLE IF EXISTS " + cfg.getSchema() + "." + table );
        connection.commit();
        ds.dispose();
    }
View Full Code Here

    private long count(PostGisConfig cfg, String table) throws PostGisException, IOException, SQLException {
        DataStore ds_ = PostGISUtils.createDatastore(cfg);
        assertTrue(ds_ instanceof JDBCDataStore);
       
        JDBCDataStore ds= (JDBCDataStore) ds_;

        Connection connection = ds.getConnection(Transaction.AUTO_COMMIT);
        connection.commit();
        Statement statement = connection.createStatement();
        ResultSet rs = statement.executeQuery("SELECT count(*) FROM " + cfg.getSchema() + "." + table );
        rs.next();
        long ret = rs.getLong(1);
        ds.dispose();
        return ret;
    }
View Full Code Here

        assertFalse(factory.canProcess(Collections.EMPTY_MAP));
        assertTrue(factory.canProcess(params));
    }
   
    public void testCreateDataStore() throws Exception {
        JDBCDataStore ds = factory.createDataStore( params );
        assertNotNull( ds );
        assertTrue(ds.getDataSource() instanceof ManageableDataSource);
    }
View Full Code Here

    }

    public void testCreateDataStoreMVCC() throws Exception {
        Map clonedParams = new HashMap(params);
        clonedParams.put(H2DataStoreFactory.MVCC.key, true);
        JDBCDataStore ds = factory.createDataStore(clonedParams);
        assertNotNull(ds);
        final DataSource source = ds.getDataSource();
        assertNotNull(source);
        final DataSource wrapped = source.unwrap(DataSource.class);
        assertNotNull(wrapped);
        if (wrapped instanceof BasicDataSource) {
            final BasicDataSource basicSource = (BasicDataSource) wrapped;
View Full Code Here

        params.put(DBTYPE.key, factory.getDatabaseID());
        params.put(SQLServerDataStoreFactory.INTSEC.key, false);
       
        assertTrue(factory.canProcess(params));
       
        JDBCDataStore store = factory.createDataStore(params);
        assertNotNull(store);
        try {
            // check dialect
            assertTrue(store.getSQLDialect() instanceof SQLServerDialect);
           
            // force connection usage
            assertNotNull(store.getSchema("ft1"));
        } finally {
            store.dispose();
        }
    }
View Full Code Here

        assertFalse(factory.canProcess(Collections.EMPTY_MAP));
        assertTrue(factory.canProcess(params));
    }
   
    public void testCreateDataStore() throws Exception {
        JDBCDataStore ds = factory.createDataStore( params );
        assertNotNull( ds );
    }
View Full Code Here

        params.put(SCHEMA.key, db.getProperty(SCHEMA.key));

        params.put(DBTYPE.key, dbtype);

        assertTrue(factory.canProcess(params));
        JDBCDataStore store = factory.createDataStore(params);
        assertNotNull(store);
        try {
            // check dialect
            assertTrue(store.getSQLDialect() instanceof TeradataDialect);

            // force connection usage
            assertNotNull(store.getSchema(tname("ft1")));
        } finally {
            store.dispose();
        }
    }
View Full Code Here

        params.put(PASSWD.key, db.getProperty("password"));
        params.put(DBTYPE.key, "oracle");
        params.put(GEOMETRY_METADATA_TABLE.key, "geometry_columns_test");

        assertTrue(factory.canProcess(params));
        JDBCDataStore store = factory.createDataStore(params);
        assertNotNull(store);
        try {
            // check dialect
            OracleDialect dialect = (OracleDialect) store.getSQLDialect();

            // check the metadata table has been set (other tests check it's actually working)
            assertEquals("geometry_columns_test", dialect.getGeometryMetadataTable());
        } finally {
            store.dispose();
        }
    }
View Full Code Here

TOP

Related Classes of org.geotools.jdbc.JDBCDataStore

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.