I want to load libspatialite-1.dll into my JAVA program, but I don't
get it to work properly
So far I've got this:
stmt.executeQuery("SELECT load_extension('libspatialite.dll')");
The error message I get is:
java.sql.SQLException: no such function: load_extension
I've got all the necessary libraries in the C:/windows/system32 folder
and it does work in sqlite3.
Thanks in advance,
Thomas
You need to ensure that sqlite has been compiled to allow for the
loading of shared libraries (--enable-dynamic-extensions).
I have had good luck using sqlite/spatialite through java with the
xerial jdbc driver:
http://www.xerial.org/trac/Xerial/wiki/SQLiteJDBC
-Justin
--
Justin Deoliveira
OpenGeo - http://opengeo.org
Enterprise support for open source geospatial.
I've tried using the drivers from the site you provided (I used a
different driver before). Now I'm getting a different error.
This is my code:
public Database(String host, String database){
makeConnection();
try {
stmt = con.createStatement();
stmt.executeQuery("SELECT load_extension('libspatialite-1.dll')");
} catch (SQLException e) {
e.printStackTrace();
}
}
//create connection
public void makeConnection(){
try{
Class.forName("org.sqlite.JDBC").newInstance();
String url = "jdbc:sqlite:mars3.sqlite";
con = DriverManager.getConnection(url);
}
catch(Exception ex){
ex.printStackTrace();
}
System.out.println("Connection succeeded");
}
And this is the error I'm getting.
[SQLITE_ERROR] SQL error or missing database (not authorized)
I hope you can help.
Thomas
> OpenGeo -http://opengeo.org