This is mostly for Larry.

I was reading this document by Alessandro Furieri 
http://www.gaia-gis.it/spatialite-2.4.0-4/splite-jdbc.html

I downloaded fresh Spatialite 4.0 dll files and tried to follow the document 
and finally I managed to compile the sample java program so that it loads and 
uses current Spatialite stuff.   All dll files which are tested to suit 
together and java code in in this zip file 
http://latuviitta.org/documents/Spatialite_4.0_test_with_jre_1.6.zip

I also learned that it is enough to have a plain SQLite connection with the 
database first. Spatialite extencion can be loaded afterwards with SQL.  
Theoretically DB Query Plugin could support all Spatialite stuff if user just 
has all the Spatialite binaries, puts them all to a directory where OS finds 
them and  loads the extension by sending SQL with DB Query Plugin as 
SELECT load_extension('path_to\spatialite-4.dll')

However, SQLite does not allow loading extensions by default and that is also 
the case with DB Query Plugin.  I believe that it would be possible to activate 
this possibility  by editing  file JumpSpatialiteDbQuery.java.
 The code is now

   @Override
   public FeatureCollection getCollection(String query, int maxFeatures) throws 
Exception
   {
      Connection connection = getConnection();
      FeatureCollection featureCollection = null;

It should be possible to load Spatialite extension later with SQL if couple of 
lines were added:
      SQLiteConfig config = new SQLiteConfig();
      config.enableLoadExtension(true);


This snippet shows how the Spatialite sample program (included in my dll 
package) creates a connection to allow extension  loading.


Connection conn = null;
    try
    {
      // enabling dynamic extension loading
      // absolutely required by SpatiaLite
      SQLiteConfig config = new SQLiteConfig();
      config.enableLoadExtension(true);

      // create a database connection
      conn = DriverManager.getConnection("jdbc:sqlite:spatialite.sample",
      config.toProperties());
      Statement stmt = conn.createStatement();
      stmt.setQueryTimeout(30); // set timeout to 30 sec.

-Jukka Rahkonen-


------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_mar
_______________________________________________
Jump-pilot-devel mailing list
Jump-pilot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel

Reply via email to