as said, identical code wrt. functionality. the permission is needed since a 
long time and you can find the code in
https://sourceforge.net/p/jump-pilot/code/HEAD/tree/core/trunk/src/com/vividsolutions/jump/datastore/spatialite/SpatialiteDataStoreDriver.java#l73

it's done via reflection but results in the proper properties being created. as 
said. needs a ticket, for now i'm stumped. ..ede


On 26.09.2020 22:04, Rahkonen Jukka (MML) wrote:
> Does  the standard datastore code contain this piece of code somewhere?  Is 
> it fired for every new connection? 
> https://sourceforge.net/p/jumpdbqplugin/code/ci/default/tree/src/main/java/org/freevoice/jumpdbqueryextension/spatialite/JumpSpatialiteDbQuery.java
>  (row #96)
>
>             //required to allow user to load extensions
>             SQLiteConfig config = new SQLiteConfig();
>             config.enableLoadExtension(true);
>             configProperties = config.toProperties();
>          }
>
> -Jukka-
>
> -----Alkuperäinen viesti-----
> Lähettäjä: edgar.sol...@web.de <edgar.sol...@web.de>
> Lähetetty: lauantai 26. syyskuuta 2020 22.09
> Vastaanottaja: jump-pilot-devel@lists.sourceforge.net
> Aihe: Re: [JPP-Devel] Spatialite datastore and mod_spatialite
>
> hey Jukka,
>
> i can replicate that mod_spatialite (v4 or 5, actually any version) is loaded 
> correctly with DBQuery but not the DataStoreLayer framework. as to why i'm 
> totally stumped as they actually do identical things codewise, wasted the 
> whole friday on this.
>
> would you mind adding a bug ticket, so this does not get lost? ..thx ede
>
> On 24.09.2020 21:08, Rahkonen Jukka (MML) wrote:
>> Hi,
>>
>>  
>>
>> It should be possible to get brand new Spatialite 5.0 into use by 
>> downloading 7zip archive 
>> http://www.gaia-gis.it/gaia-sins/windows-bin-NEXTGEN-amd64/spatialite-loadable-modules-5.0.0-win-amd64.7z
>>  
>> <http://www.gaia-gis.it/gaia-sins/windows-bin-NEXTGEN-amd64/spatialite-loadable-modules-5.0.0-win-amd64.7z>
>>  and placing all the dll files into lib/ext. I could indeed make 
>> mod_spatialite to load into DB Query plugin by using connection string as 
>> jdbc:sqlite:c:\data\mtk\mtkmaasto.gpkg?spatialite=mod_spatialite.dll. 
>> Extension is not needed but module is loaded also by using 
>> "?spatialite=mod_spatialite".
>>
>>  
>>
>> However, mod_spatialite is not loaded into normal Spatialite datastore 
>> connection even the code in 
>> https://github.com/openjump-gis/openjump-migration/blob/master/src/com/vividsolutions/jump/datastore/spatialite/SpatialiteDSMetadata.java
>>  
>> <https://github.com/openjump-gis/openjump-migration/blob/master/src/com/vividsolutions/jump/datastore/spatialite/SpatialiteDSMetadata.java>
>>  tries to do it.
>>
>>  
>>
>> Log output when testing with a query "select spatialite_version()" shows 
>> this:
>>
>> [INFO] 21:15:16.321 Target database URL : 
>> jdbc:sqlite:C:\data\mtk\mtkmaasto.gpkg
>>
>> [INFO] 21:15:16.334 java.net.preferIPv4Stack=null
>>
>> [INFO] 21:15:16.335 java.net.preferIPv6Addresses=null
>>
>> [WARN] 21:15:16.464 SpatialDatabasesPlugin: CANNOT load Spatialite extension 
>> (mod_spatialite).
>>
>> org.sqlite.SQLiteException: [SQLITE_ERROR] SQL error or missing database 
>> (not authorized)
>>
>>         at org.sqlite.core.DB.newSQLException(DB.java:1010)
>>
>>         at org.sqlite.core.DB.newSQLException(DB.java:1022)
>>
>>         at org.sqlite.core.DB.throwex(DB.java:987)
>>
>>         at org.sqlite.core.NativeDB._exec_utf8(Native Method)
>>
>>         at org.sqlite.core.NativeDB._exec(NativeDB.java:94)
>>
>>         at 
>> org.sqlite.jdbc3.JDBC3Statement.executeUpdate(JDBC3Statement.java:109)
>>
>>         at 
>> com.vividsolutions.jump.datastore.spatialite.SpatialiteDSMetadata.checkSpatialiteLoaded(SpatialiteDSMetadata.java:293)
>>
>>         at 
>> com.vividsolutions.jump.datastore.spatialite.SpatialiteDSMetadata.<init>(SpatialiteDSMetadata.java:82)
>>
>>         at 
>> com.vividsolutions.jump.datastore.spatialite.SpatialiteDSConnection.<init>(SpatialiteDSConnection.java:22)
>>
>>         at 
>> com.vividsolutions.jump.datastore.spatialite.SpatialiteDataStoreDriver.createConnection(SpatialiteDataStoreDriver.java:90)
>>
>>         at 
>> com.vividsolutions.jump.workbench.datastore.ConnectionDescriptor.createConnection(ConnectionDescriptor.java:75)
>>
>>         at 
>> com.vividsolutions.jump.workbench.datastore.ConnectionManager.getOpenConnection(ConnectionManager.java:93)
>>
>>         at 
>> com.vividsolutions.jump.workbench.ui.plugin.datastore.RunDatastoreQueryPlugIn.createLayer(RunDatastoreQueryPlugIn.java:76)
>>
>>         at 
>> com.vividsolutions.jump.workbench.ui.plugin.datastore.RunDatastoreQueryPlugIn.createLayerable(RunDatastoreQueryPlugIn.java:41)
>>
>>         at 
>> com.vividsolutions.jump.workbench.ui.plugin.datastore.AbstractAddDatastoreLayerPlugIn.run(AbstractAddDatastoreLayerPlugIn.java:33)
>>
>>         at 
>> com.vividsolutions.jump.workbench.ui.task.TaskMonitorManager$TaskWrapper.run(TaskMonitorManager.java:151)
>>
>> [ERROR] 21:15:17.547 java.lang.Error: [SQLITE_ERROR] SQL error or missing 
>> database (no such function: spatialite_version)
>>
>> Invalid query: select spatialite_version()
>>
>> java.lang.Exception: java.lang.Error: [SQLITE_ERROR] SQL error or missing 
>> database (no such function: spatialite_version)
>>
>> Invalid query: select spatialite_version()
>>
>>         at 
>> com.vividsolutions.jump.workbench.ui.plugin.datastore.RunDatastoreQueryPlugIn.createLayer(RunDatastoreQueryPlugIn.java:92)
>>
>>         at 
>> com.vividsolutions.jump.workbench.ui.plugin.datastore.RunDatastoreQueryPlugIn.createLayerable(RunDatastoreQueryPlugIn.java:41)
>>
>>         at 
>> com.vividsolutions.jump.workbench.ui.plugin.datastore.AbstractAddDatastoreLayerPlugIn.run(AbstractAddDatastoreLayerPlugIn.java:33)
>>
>>         at 
>> com.vividsolutions.jump.workbench.ui.task.TaskMonitorManager$TaskWrapper.run(TaskMonitorManager.java:151)
>>
>> Caused by: java.lang.Error: [SQLITE_ERROR] SQL error or missing database (no 
>> such function: spatialite_version)
>>
>> Invalid query: select spatialite_version()
>>
>>         at 
>> com.vividsolutions.jump.datastore.spatialdatabases.SpatialDatabasesFeatureInputStream.getFeatureSchema(SpatialDatabasesFeatureInputStream.java:122)
>>
>>         at 
>> com.vividsolutions.jump.datastore.spatialite.SpatialiteDSConnection.executeAdhocQuery(SpatialiteDSConnection.java:82)
>>
>>         at 
>> com.vividsolutions.jump.datastore.spatialdatabases.SpatialDatabasesDSConnection.execute(SpatialDatabasesDSConnection.java:56)
>>
>>         at 
>> com.vividsolutions.jump.workbench.ui.plugin.datastore.RunDatastoreQueryPlugIn$RunnableQuery.run(RunDatastoreQueryPlugIn.java:134)
>>
>> Caused by: org.sqlite.SQLiteException: [SQLITE_ERROR] SQL error or missing 
>> database (no such function: spatialite_version)
>>
>>         at org.sqlite.core.DB.newSQLException(DB.java:1010)
>>
>>         at org.sqlite.core.DB.newSQLException(DB.java:1022)
>>
>>         at org.sqlite.core.DB.throwex(DB.java:987)
>>
>>         at org.sqlite.core.NativeDB.prepare_utf8(Native Method)
>>
>>         at org.sqlite.core.NativeDB.prepare(NativeDB.java:134)
>>
>>         at org.sqlite.core.DB.prepare(DB.java:264)
>>
>>         at 
>> org.sqlite.jdbc3.JDBC3Statement.executeQuery(JDBC3Statement.java:73)
>>
>>         at 
>> com.vividsolutions.jump.datastore.spatialdatabases.SpatialDatabasesFeatureInputStream.init(SpatialDatabasesFeatureInputStream.java:75)
>>
>>         at 
>> com.vividsolutions.jump.datastore.spatialdatabases.SpatialDatabasesFeatureInputStream.getFeatureSchema(SpatialDatabasesFeatureInputStream.java:116)
>>
>>         ... 3 more
>>
>>  
>>
>> I tried also to drop the dll files into \lib instead of \lib\ext but the 
>> result was the same.
>>
>>  
>>
>> Because the error is "not authorized" I was thinking that perhaps something 
>> goes wrong with enabling the loading of extensions but I could not find 
>> where it is set in the code. It must be somewhere because by default it is 
>> not allowed to load extensions.
>>
>>  
>>
>> -Jukka Rahkonen-
>>
>>  
>>
>>
>>
>> _______________________________________________
>> Jump-pilot-devel mailing list
>> Jump-pilot-devel@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel
>>
>
>
>
> _______________________________________________
> Jump-pilot-devel mailing list
> Jump-pilot-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel
>
>
> _______________________________________________
> Jump-pilot-devel mailing list
> Jump-pilot-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel
>



_______________________________________________
Jump-pilot-devel mailing list
Jump-pilot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel

Reply via email to