Class SpatialDatabasesDSConnection
- java.lang.Object
-
- com.vividsolutions.jump.datastore.spatialdatabases.SpatialDatabasesDSConnection
-
- All Implemented Interfaces:
DataStoreConnection
- Direct Known Subclasses:
H2DSConnection
,MariadbDSConnection
,OracleDSConnection
,PostgisDSConnection
,SpatialiteDSConnection
public class SpatialDatabasesDSConnection extends Object implements DataStoreConnection
Base class for all spatial databases DataStore connections. No need to subclass for PostGIS, Oracle Spatial,- Author:
- nicolas Ribot
-
-
Field Summary
Fields Modifier and Type Field Description protected Connection
connection
protected SpatialDatabasesDSMetadata
dbMetadata
-
Constructor Summary
Constructors Constructor Description SpatialDatabasesDSConnection(Connection conn)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
FeatureInputStream
execute(Query query)
run a queryFeatureInputStream
executeAdhocQuery(AdhocQuery query)
select gid, geom from departement where nom like 'A%' Executes an adhoc query (direct SQL query)FeatureInputStream
executeFilterQuery(FilterQuery query)
Executes a filter query.String[]
getCompatibleSchemaSubset(String schemaName, String tableName, FeatureSchema featureSchema, boolean normalizedColumnNames)
Connection
getJdbcConnection()
expose underlying JDBC connectionSpatialDatabasesDSMetadata
getMetadata()
retrieve metadata describing the database's datasets (column names etc.)SpatialDatabasesSQLBuilder
getSqlBuilder(SpatialReferenceSystemID srid, String[] colNames)
expose sqlbuilderSpatialDatabasesValueConverterFactory
getValueConverterFactory()
boolean
isClosed()
-
-
-
Field Detail
-
dbMetadata
protected SpatialDatabasesDSMetadata dbMetadata
-
connection
protected Connection connection
-
-
Constructor Detail
-
SpatialDatabasesDSConnection
public SpatialDatabasesDSConnection(Connection conn)
-
-
Method Detail
-
getJdbcConnection
public Connection getJdbcConnection()
Description copied from interface:DataStoreConnection
expose underlying JDBC connection- Specified by:
getJdbcConnection
in interfaceDataStoreConnection
- Returns:
- the Connection
-
getMetadata
public SpatialDatabasesDSMetadata getMetadata()
Description copied from interface:DataStoreConnection
retrieve metadata describing the database's datasets (column names etc.)- Specified by:
getMetadata
in interfaceDataStoreConnection
- Returns:
- the DataStoreMetadata
-
getSqlBuilder
public SpatialDatabasesSQLBuilder getSqlBuilder(SpatialReferenceSystemID srid, String[] colNames)
Description copied from interface:DataStoreConnection
expose sqlbuilder- Specified by:
getSqlBuilder
in interfaceDataStoreConnection
- Parameters:
srid
- the SpatialReferenceSystemIDcolNames
- array of columns to query- Returns:
- the SpatialDatabasesSQLBuilder
-
execute
public FeatureInputStream execute(Query query) throws Exception
Description copied from interface:DataStoreConnection
run a query- Specified by:
execute
in interfaceDataStoreConnection
- Parameters:
query
- the query to execute- Returns:
- a FeatureInputStream
- Throws:
Exception
- if an Exception occurs during query execution- See Also:
Query
-
executeFilterQuery
public FeatureInputStream executeFilterQuery(FilterQuery query) throws SQLException
Executes a filter query. The SRID is optional for queries - it will be determined automatically from the table metadata if not supplied.- Parameters:
query
- the query to execute- Returns:
- the results of the query
- Throws:
SQLException
- if an Exception occurs during query execution
-
executeAdhocQuery
public FeatureInputStream executeAdhocQuery(AdhocQuery query) throws Exception
select gid, geom from departement where nom like 'A%' Executes an adhoc query (direct SQL query)- Parameters:
query
- the query to execute- Returns:
- a featureInputStream containing query's features
- Throws:
Exception
- if no geometric column is found in the query
-
close
public void close() throws DataStoreException
- Specified by:
close
in interfaceDataStoreConnection
- Throws:
DataStoreException
-
isClosed
public boolean isClosed() throws DataStoreException
- Specified by:
isClosed
in interfaceDataStoreConnection
- Throws:
DataStoreException
-
getValueConverterFactory
public SpatialDatabasesValueConverterFactory getValueConverterFactory()
-
-