"how to include sqlite database in executable jar?" Code Answer


what library are you using for sqlite?

i did a search based on the connection uri you indicated and found this one. in the documentation it says:

2009 may 19th: sqlite-jdbc- released. this version supports "jdbc:sqlite::resource:" syntax to access read-only db files contained in jar archives, or external resources specified via url, local files address etc. (see also the detailes)

if that is the driver you are using, then i would suggest the following connection uri:


the key is that since your database is in a jar file, it can not be access as a file with fileinputstream. instead it must be accessed through the jvm's support for it (namely with class.getresource() or class.getresourceasstream()). do note that resources contained within jar files are read-only. you won't be able to save any changes to your database.

By Reft on April 11 2022

Answers related to “how to include sqlite database in executable jar?”

Only authorized users can answer the Search term. Please sign in first, or register a free account.