| |
|
| java.lang.Object org.geotools.referencing.factory.epsg.SimpleDataSource
SimpleDataSource | public class SimpleDataSource implements DataSource(Code) | | Open a connection to an EPSG database using
DriverManager . This implementation is not
suitable for uses with Java Naming and Directory (JNDI), but it provides a convenient base class
for connections determined from properties files.
The default implementation doesn't make any assumption about where the properties file is
located. The properties file location must be supplied at construction time. Because this
base class dosn't have a no-argument constructor, it can't be registered in the
META-INF/services/ directory. If such a registration is wanted (for automatic detection
by
org.geotools.referencing.ReferencingFactoryFinder , then users must provide a subclass with a
no-argument constructor.
The properties file to be supplied at construction time shall contains the following:
Property |
Description |
Default |
url |
The URL to the EPSG database |
jdbc:odbc:EPSG |
schema |
The schema containing EPSG tables in the database |
|
user |
User used to make database connections |
|
password |
Password used to make database connections |
|
driver |
The JDBC driver to load |
sun.jdbc.odbc.JdbcOdbcDriver |
factory |
The EPSG factory to instantiate |
org.geotools.referencing.factory.epsg.DirectEpsgFactory |
since: 2.2 version: $Id: SimpleDataSource.java 26096 2007-06-29 21:45:12Z jgarnett $ author: Martin Desruisseaux javax.sql.DataSource ThreadedEpsgFactory |
Field Summary | |
final protected Properties | properties The properties used for etablishing the database connection. |
properties | final protected Properties properties(Code) | | The properties used for etablishing the database connection. See the
for the expected content.
This field is never
null .
|
SimpleDataSource | public SimpleDataSource(Properties properties)(Code) | | Constructs a data source with the specified properties.
The properties given to this constructor are not cloned.
Parameters: properties - The properties, or null for an empty set. |
SimpleDataSource | public SimpleDataSource(File file) throws IOException(Code) | | Constructs a data source with properties loaded from the specified file.
Parameters: file - The properties file to load. throws: IOException - if an error occured while loading the properties file. |
createFactory | public AbstractAuthorityFactory createFactory(Hints hints) throws SQLException(Code) | | Opens a connection and creates an EPSG factory for it. The default implementation attempts
to create an instance of the class specified by the
"factory" key. This class shall
have a constructor expecting the following arguments in that order:
Hints ,
Connection .
|
getConnection | public Connection getConnection() throws SQLException(Code) | | Attempts to establish a connection with the data source.
A connection to the data source. exception: SQLException - if a database access error occurs. |
getConnection | public Connection getConnection(String username, String password) throws SQLException(Code) | | Attempts to establish a connection with the data source.
Parameters: username - The database user on whose behalf the connection is being made. Parameters: password - The user's password. A connection to the data source. exception: SQLException - if a database access error occurs. |
getLoginTimeout | public int getLoginTimeout() throws SQLException(Code) | | Gets the maximum time in seconds that this data source can wait while attempting to
connect to a database. The default implementation returns zero, which means that the
timeout is the default system timeout .
|
isWrapperFor | public boolean isWrapperFor(Class type) throws SQLException(Code) | | Not implemented. This method is defined for Java 6 compatibility only.
since: 2.4 |
setLoginTimeout | public void setLoginTimeout(int seconds) throws SQLException(Code) | | Sets the maximum time in seconds that this data source will wait while attempting to
connect to a database. The default implementation does nothing.
|
unwrap | public Object unwrap(Class type) throws SQLException(Code) | | Not implemented. This method is defined for Java 6 compatibility only.
since: 2.4 |
|
|
|