Fixed SQLite driver loading
This commit is contained in:
parent
e2561ca672
commit
e1f520911f
@ -9,8 +9,10 @@ Require-Bundle: com.minres.scviewer.database;bundle-version="1.0.0",
|
||||
org.eclipse.equinox.util;bundle-version="1.0.500",
|
||||
org.eclipse.equinox.ds;bundle-version="1.4.200",
|
||||
org.eclipse.osgi.services;bundle-version="3.4.0"
|
||||
Bundle-ClassPath: .,
|
||||
sqlite-jdbc-3.8.7.jar
|
||||
Bundle-ClassPath: .,sqlite-jdbc-3.8.7.jar
|
||||
Service-Component: OSGI-INF/component.xml
|
||||
Export-Package: com.minres.scviewer.database.sqlite
|
||||
Bundle-ActivationPolicy: lazy
|
||||
Embed-Dependency: sqlite-jdbc
|
||||
Embedded-Artifacts: sqlite-jdbc-3.8.7.jar;g="org.xerial";
|
||||
a="sqlite-jdbc";v="3.8.7"
|
||||
|
@ -1,19 +1,6 @@
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>com.minres.scviewer.database.sqlite</artifactId>
|
||||
<build>
|
||||
<sourceDirectory>src</sourceDirectory>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.1</version>
|
||||
<configuration>
|
||||
<source>1.7</source>
|
||||
<target>1.7</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<parent>
|
||||
<groupId>com.minres.scviewer</groupId>
|
||||
<artifactId>com.minres.scviewer.parent</artifactId>
|
||||
@ -21,4 +8,11 @@
|
||||
<relativePath>../com.minres.scviewer.parent</relativePath>
|
||||
</parent>
|
||||
<packaging>eclipse-plugin</packaging>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.xerial</groupId>
|
||||
<artifactId>sqlite-jdbc</artifactId>
|
||||
<version>3.8.7</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
@ -10,6 +10,8 @@
|
||||
*******************************************************************************/
|
||||
package com.minres.scviewer.database.sqlite.db;
|
||||
|
||||
import java.net.URL;
|
||||
import java.net.URLClassLoader;
|
||||
import java.sql.Connection;
|
||||
import java.sql.DriverManager;
|
||||
import java.sql.PreparedStatement;
|
||||
@ -18,12 +20,27 @@ import java.sql.SQLException;
|
||||
import java.sql.Statement;
|
||||
import java.util.HashMap;
|
||||
|
||||
import org.sqlite.JDBC;
|
||||
|
||||
public class SQLiteDatabase implements IDatabase {
|
||||
|
||||
protected String dbFileName;
|
||||
|
||||
protected HashMap<String, Object> props;
|
||||
|
||||
static {
|
||||
try {
|
||||
URL dbUrl = SQLiteDatabase.class.getResource("/sqlite-jdbc-3.8.7.jar");
|
||||
ClassLoader loader = URLClassLoader.newInstance(
|
||||
new URL[] { dbUrl },
|
||||
SQLiteDatabase.class.getClassLoader()
|
||||
);
|
||||
Class.forName("org.sqlite.JDBC", true, loader);
|
||||
} catch (ClassNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public SQLiteDatabase(String dbFileName) {
|
||||
super();
|
||||
this.dbFileName = dbFileName;
|
||||
|
@ -12,6 +12,7 @@
|
||||
<module>../com.minres.scviewer.database.vcd</module>
|
||||
<module>../com.minres.scviewer.feature</module>
|
||||
<module>../com.minres.scviewer.ui</module>
|
||||
|
||||
<module>../com.minres.scviewer.updateSite</module>
|
||||
<module>../com.minres.scviewer.database.test</module>
|
||||
</modules>
|
||||
|
Loading…
Reference in New Issue
Block a user