Hi,
I've successfully got Hibernate to access a SQLite database file in a read-only manner. (Used a dialect file freely available on the web and an open source SQLite JDBC driver - problems trying to update the schema, but it does not affect my read only task.)
However, my problem is that I want to stick this sqlite database file inside a JAR file.
The attempted connection info and error reported is shown below. The code works fine if I just have
Code:
<property name="connection.url">jdbc:sqlite:databasefile.sqlite</property>
and put that sqlite file in the Java working directory for the project. ie it's
not an issue of the sqlite file or the JAR file being visible to Java.
It seems that you cannot specify a JAR file as a URL in this config file?
Does anyone know of a way around this? Can you programmatically do everything specified in this XML file and at some point then use the JAR URL Connection format that seems to be causing issues when parsed from the XML?
Thanks,
Steve
Hibernate version: 3.3.1.GA (Core)
Database Connection info from hibernate.cfg.xml:
<property name="connection.driver_class">org.sqlite.JDBC</property>
<property name="connection.url">jdbc:sqlite:jar:file://C:/folder/somefile.jar!databasefile.sqlite</property>
<property name="connection.username"></property>
<property name="connection.password"></property>
Relevant trace of the exception that occurs:
2009-04-07 14:57:24,193 WARN (org.hibernate.cfg.SettingsFactory:144) [buildSettings] Could not obtain connection metadata
java.sql.SQLException: path to 'jar:file://C:/folder/somefile.jar!databasefile.sqlite': 'C:\folder\jar:file:' does not exist
2009-04-07 14:57:24,443 ERROR (org.hibernate.tool.hbm2ddl.SchemaUpdate:175) [execute] could not get database metadata
java.sql.SQLException: path to 'jar:file://C:/folder/somefile.jar!databasefile.sqlite': 'C:\folder\jar:file:' does not exist
2009-04-07 14:57:24,506 WARN (org.hibernate.util.JDBCExceptionReporter:100) [logExceptions] SQL Error: 0, SQLState: null
2009-04-07 14:57:24,506 ERROR (org.hibernate.util.JDBCExceptionReporter:101) [logExceptions] path to 'jar:file://C:/folder/somefile.jar!databasefile.sqlite': 'C:\folder\jar:file:' does not exist
Name and version of the database you are using: SQLite version 3.6.11