Hello all

An EPSG factory on MS-Access (the primary format in which the EPSG
factory is distributed) has been committed. Adaptation to ANSI SQL will
follow. The method javadoc gives a few EPSG codes as examples [1]. Those
examples are only a small subset since the EPSG database provides many
thousands of definitions. A more exhaustive list of EPSG codes can be
seen at [2] (that list will be ported to SIS next month).

The current strategy for fetching a connection to the EPSG database is:

 1. If a JNDI context exists, get the DataSource for the
    "jdbc/SpatialMetadata" name. JNDI is provided by various containers
    like Tomcat and OSGi. For example [3] and [4] show how to set a JNDI
    DataSource in Tomcat.
 2. Otherwise if the SIS_DATA environment variable is defined, search
    for Derby database in $SIS_DATA/Databases/SpatialMetadata.
 3. Otherwise if the "derby.system.home" Java property is defined,
    search for a "jdbc:derby:SpatialMetadata" database. Derby will
    search it in the directory given by "derby.system.home" property.
 4. Otherwise fail (do not try to open a database in a random location).

For choice 1 above, the JDBC driver must be provided by the container.
SIS will not add any driver by itself.

For choices 2 and 3 above, SIS searches for a Derby driver as below:

 1. If a driver is found in the context ClassLoader of the current
    thread, us it.
 2. Otherwise create a URLClassLoader to "$java.home/../db/derby.jar",
    which is the location where Oracle distribute the Derby database
    together with the JDK.
 3. If no driver is found, fail. SIS does not carry any JDBC driver
    dependency; it just tries to use what exists.

Any comment? The above strategy lack an easy way (other than choice 1)
to use another driver like PostgreSQL, but before to add more complexity
I would like to see how using PostgreSQL with option 1 (JNDI) works with
Tomcat.

    Martin


[1] 
https://builds.apache.org/job/sis-dev/javadoc/org/apache/sis/referencing/factory/sql/EPSGFactory.html#createCoordinateReferenceSystem-java.lang.String-
[2] http://www.geotoolkit.org/modules/referencing/supported-codes.html
[3] https://tomcat.apache.org/tomcat-9.0-doc/jndi-resources-howto.html
[4] 
http://theopentutorials.com/examples/java-ee/servlet/servlet-jndi-datasource-in-tomcat/


Reply via email to