1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- //package com.onemap.overlap.utils;
- //
- //import java.sql.Connection;
- //import java.sql.ResultSet;
- //import java.sql.SQLException;
- //import java.sql.Statement;
- //
- //import org.sqlite.SQLiteConfig;
- //
- //public class SpatialiteSample {
- //
- //
- // public static void main(String[] args) throws ClassNotFoundException, SQLException {
- // // load the sqlite-JDBC driver using the current class loader
- // Class.forName("org.sqlite.JDBC");
- //
- // Connection conn = null;
- // try {
- // // enabling dynamic extension loading
- // // absolutely required by SpatiaLite
- // System.out.println(org.sqlite.SQLiteJDBCLoader.getVersion());
- //// System.setProperty("java.library.path", "E:\\google-download\\mod_spatialite-5.0.1-win-amd64\\mod_spatialite-5.0.1-win-amd64");
- // SQLiteConfig config = new SQLiteConfig();
- // config.enableLoadExtension(true);
- // conn = config.createConnection("jdbc:sqlite:D:\\temp\\mappatchcheck.sqlite");
- // // create a database connection
- //// conn = DriverManager.getConnection("jdbc:sqlite:spatialite-test.sqlite?enable_load_extension=1"
- //// );
- //// conn.enableLoadExtension(true);
- // Statement stmt = conn.createStatement();
- // stmt.setQueryTimeout(30); // set timeout to 30 sec.
- //
- // // loading SpatiaLite
- // stmt.execute("SELECT load_extension('mod_spatialite')");
- //
- // // checking SQLite and SpatiaLite version + target CPU
- // String sql = "SELECT spatialite_version(), spatialite_target_cpu()";
- // ResultSet rs = stmt.executeQuery(sql);
- // while (rs.next()) {
- // // read the result set
- // String msg = "SQLite version: ";
- // msg += rs.getString(1);
- // System.out.println(msg);
- // msg = "SpatiaLite version: ";
- // msg += rs.getString(2);
- // System.out.println(msg);
- // }
- // // enabling Spatial Metadata
- // // this automatically initializes SPATIAL_REF_SYS and GEOMETRY_COLUMNS
- //// sql = "SELECT InitSpatialMetadata(1)";
- //// stmt.execute(sql);
- // } catch (SQLException e) {
- // throw new RuntimeException(e);
- // }
- // }
- //}
|