<p>Hi all,</p><p>I'd like discussing a couple of things with you after
all the tests I've done during this first time past for finding out
which was the most reasonable approach to get SQLite and SpatiaLite
support into gvSIG. </p><p>Brief introduction: </p><p>I've tested all
the approaches and resources we've discussed [1] and all those I could
find asking around and scanning the web. </p><p>Results: </p><p>SQLITE
SUPPORT </p><p>- The Xerial SQLite driver[2], derived from the
Zentus'one [3], developed and mantained by Taro L. Saito of the
University of Tokyo looks to be the most suitable for accomplishing our
tasks. </p><p>The reasons are mainly:<br>- it's kept updated and
recompiled with every new version of SQLite <br>- it has some
improvements and some fixing <br> - you need to include in your project
just one file (sqlite-jdbc.jar) in order to use it <br>- as far as it's a
java jar it's multiplatform </p><p>SPATIALITE <br>- you can import the
libspatialite.* file (according to your system) with Xerial sqlite-JDBC
driver(see above)[2] and reading data from a SpatiaLite database <br> -
I've found many bugs in doing Spatialite's operations (due probably to
bugs in memory handling of SpatiaLite functions into java-driver): that
means I can do any SELECT with SpatiaLite's functions (I've tested many
of them) retrieving the data I want BUT with a silly workaround that
avoids the crash of the JVM (usually in connection closing / statment
reset) <br> - I can't write data at the moment (I've found no
workarounds/fixing yet) because of other errors in memory handling. <br>I've
got in touch with Taro L. Saito but I guess he has not found any fixing
for that segmentation fault.<br>I will try to write him again hoping he
has time to fix this problem. </p><p>CONCLUSIONS </p><p>I guess that
thanks to SQLite-JDBC driver [2] including SQLite support into gvSIG
should be quite quick (Cèsar has suggested me to see the libFMap_daldb
for understanding how MySQL, etc are already supported in our
application). </p><p>SpatiaLite support needs to be discussed a little
bit because the reading it's quite straightforward (keeping in mind we
can make it work with a workaround. That's not proper but as a temporary
solution could be partially acceptable), including the proper library
(according to OS and architecture) thanks to the SQLite-JDBC driver as
well. </p><p>SOLUTION I PROPOSE ABOUT SPATIALITE </p><p>Well, I'd need
hearing your ideas about this matter anyway and discuss together about
which whould be the better way to get spatialite support. </p><p>However
I've a proposal to get finally a much better work in my opinion: I've
almost finished the code for decoding the SPATIALITE BLOB[5] (that's the
particular structure that stores every Spatialite infos) and I guess
the better thing would be implementing a Java version of SpatiaLite or
at least of its most common functionalities. <br>For many of them we
could have help from JTS[4] (as partially suggested by Juan Lucas [1]). <br> </p><p>Firstly
it would let us having just one file (a common java jar) for every OS
and architecture, instead of having a lib file for each most common
machine.<br> It would avoid the necessity of trying to wrap a C lib
into a JAVA interface with all the problems we have already with the
memory handling in importing libspatialite.* into the already fully
working driver [2]. <br>It would take some time BUT finally we will have
a much cleaner and multiplatform solution. </p><p>Sorry for the maybe
too long paper, </p><p>Cheers, </p><p>Luca </p><p>[1]
<a href="http://osgeo-org.1803224.n2.nabble.com/New-Student-for-GVSIG-within-Google-Summer-Of-Code-2010-quick-introduction-td5014112.html#a5014112">http://osgeo-org.1803224.n2.nabble.com/New-Student-for-GVSIG-within-Google-Summer-Of-Code-2010-quick-introduction-td5014112.html#a5014112</a>
<br>[2] <a href="http://www.xerial.org/trac/Xerial/wiki/SQLiteJDBC">http://www.xerial.org/trac/Xerial/wiki/SQLiteJDBC</a> <br>[3]
<a href="http://www.zentus.com/sqlitejdbc/">http://www.zentus.com/sqlitejdbc/</a> <br>[4]
<a href="http://www.vividsolutions.com/jts/jtshome.htm">http://www.vividsolutions.com/jts/jtshome.htm</a> <br>[5]
<a href="http://www.gaia-gis.it/spatialite/spatialite-manual-2.3.1.html#t3.3">http://www.gaia-gis.it/spatialite/spatialite-manual-2.3.1.html#t3.3</a></p>