From: <svn...@os...> - 2012-05-01 18:57:55
|
Author: jdeolive Date: 2012-05-01 11:57:46 -0700 (Tue, 01 May 2012) New Revision: 38698 Modified: trunk/docs/src/main/java/org/geotools/jdbc/JDBCExamples.java trunk/docs/user/library/jdbc/datastore.rst trunk/docs/user/library/jdbc/h2.rst trunk/docs/user/library/jdbc/postgis.rst trunk/docs/user/library/jdbc/spatiallite.rst Log: some tweaks to jdbc documentation, pointing at correct code samples Modified: trunk/docs/src/main/java/org/geotools/jdbc/JDBCExamples.java =================================================================== --- trunk/docs/src/main/java/org/geotools/jdbc/JDBCExamples.java 2012-05-01 10:03:00 UTC (rev 38697) +++ trunk/docs/src/main/java/org/geotools/jdbc/JDBCExamples.java 2012-05-01 18:57:46 UTC (rev 38698) @@ -19,6 +19,30 @@ // h2Example end } +void h2AbsPathExample() throws IOException { + // h2AbsPathExample start + Map<String,Object> params = new HashMap<String,Object>(); + params.put("dbtype", "h2"); + params.put("database", "/abs/path/to/geotools"); + + DataStore datastore = DataStoreFinder.getDataStore(params); + // h2AbsPathExample end +} + +void h2TcpExample() throws IOException { + // h2TcpExample start + Map<String,Object> params = new HashMap<String,Object>(); + params.put("dbtype", "h2"); + params.put("host", "localhost"); + params.put("port", 9902); + params.put("database", "geotools"); + params.put("passwd", "geotools"); + params.put("passwd", "geotools"); + + DataStore datastore = DataStoreFinder.getDataStore(params); + // h2TcpExample end +} + void postgisExample() throws IOException { // postgisExample start Map<String,Object> params = new HashMap<String,Object>(); Modified: trunk/docs/user/library/jdbc/datastore.rst =================================================================== --- trunk/docs/user/library/jdbc/datastore.rst 2012-05-01 10:03:00 UTC (rev 38697) +++ trunk/docs/user/library/jdbc/datastore.rst 2012-05-01 18:57:46 UTC (rev 38698) @@ -10,7 +10,7 @@ The process of creating a JDBC data store follows the regular steps of creating any type of datastore. That is defining the parameters to connect to the database in a map, and then creating the data store factory.: -.. literalinclude:: /../src/main/java/org/geotools/data/SimpleFeatureStoreExamples.java +.. literalinclude:: /../src/main/java/org/geotools/jdbc/JDBCExamples.java :language: java :start-after: // postgisExample start :end-before: // postgisExample end Modified: trunk/docs/user/library/jdbc/h2.rst =================================================================== --- trunk/docs/user/library/jdbc/h2.rst 2012-05-01 10:03:00 UTC (rev 38697) +++ trunk/docs/user/library/jdbc/h2.rst 2012-05-01 18:57:46 UTC (rev 38698) @@ -36,7 +36,26 @@ Here is a quick example: -.. literalinclude:: /../src/main/java/org/geotools/data/SimpleFeatureStoreExamples.java +.. literalinclude:: /../src/main/java/org/geotools/jdbc/JDBCExamples.java :language: java :start-after: // h2Example start :end-before: // h2Example end + +The above will reference a database file named "geotools" located in the current working directory. +A full path may also be specified: + +.. literalinclude:: /../src/main/java/org/geotools/jdbc/JDBCExamples.java + :language: java + :start-after: // h2AbsPathExample start + :end-before: // h2AbsPathExample end + +The above examples create a connection to H2 in "embedded" mode. One limitation to this approach is +that it only allows for a single java process to access the database at any one time. H2 also offers +a `server mode <http://www.h2database.com/html/tutorial.html#using_server>`_ in which access +to the underlying database is made via traditional client-server TCP connection, and removes the embedded +single process restriction: + +.. literalinclude:: /../src/main/java/org/geotools/jdbc/JDBCExamples.java + :language: java + :start-after: // h2TcpExample start + :end-before: // h2TcpExample end Modified: trunk/docs/user/library/jdbc/postgis.rst =================================================================== --- trunk/docs/user/library/jdbc/postgis.rst 2012-05-01 10:03:00 UTC (rev 38697) +++ trunk/docs/user/library/jdbc/postgis.rst 2012-05-01 18:57:46 UTC (rev 38698) @@ -41,7 +41,7 @@ Connect using DataStore finder: -.. literalinclude:: /../src/main/java/org/geotools/data/SimpleFeatureStoreExamples.java +.. literalinclude:: /../src/main/java/org/geotools/jdbc/JDBCExamples.java :language: java :start-after: // postgisExample start :end-before: // postgisExample end Modified: trunk/docs/user/library/jdbc/spatiallite.rst =================================================================== --- trunk/docs/user/library/jdbc/spatiallite.rst 2012-05-01 10:03:00 UTC (rev 38697) +++ trunk/docs/user/library/jdbc/spatiallite.rst 2012-05-01 18:57:46 UTC (rev 38698) @@ -55,9 +55,24 @@ * Native Libraries - The SpatiaLite data store requires the native libraries for SQLite - and SpatiaLite to be installed on the system. Precompiled libraries for - SQLite and SpatiaLite are available. + The SpatiaLite datastore ships with its own build of the SQLite and SpatiaLite + libraries. The SpatiaLite component has been compiled with GEOS and PROJ support + so those libraries need to be installed on the system for the datastore to + function. Binaries for a variety of platforms are available at https://www.gaia-gis.it/fossil/libspatialite/index. + + See also: - * http://www.sqlite.org/download.html - * http://www.gaia-gis.it/spatialite/binaries.html + * http://trac.osgeo.org/proj/ + * http://trac.osgeo.org/geos/ + +* Java Environment + + In order to load the native libraries at runtime Java must be told where the libraries live + with a system property named "java.library.path". This is specified during java startup:: + + java -Djava.library.path=/usr/local/lib ... + + Depending on how the O/S is configured the additional ``LD_LIBRARY_PATH`` (unix/linux) and + ``DYLD_LIBRARY_PATH`` (osx) environment variables may need to be set. + + |