开发者

Is it possible to access a SQLite database file outside of an executable JAR?

I have an application that I deploy as an executable JAR file. Originally, this JAR file would communicate with a MySQL database but recently I have decided I want to go with SQLite instead. However, while testing I found that I could not access my SQLite database file when running my application from the JAR file.

I'm using the JDBC driver from the following website: http://zentus.com/sqlitejdbc/index.html

Is there a workaround I have to do?

The driver works great while testing in my Eclipse environment, but doesn't seem to work standalone in a JAR file. Any help would be greatly appreciate开发者_如何学Cd.


Well, here is such term as "working directory". It is the directory from where your application is started. So, every "relative" path in your application is usually relative to this "working directory".

Now let's return to your problem. When you set the path to a file you can make it either relative, absolute or relative to the JAR inner directory root, depending how you do create the file and set the path.

So, just recheck how paths are set in your application and try to use the relative one, running you application from the appropriate directory.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜