Distribute a database made with JavaDB with Java program -


i'm creating program in java in have use lot of tables. made decision create tables in javadb file.

however, want distribute filled javadb file jar file distribution, since connecting server not option.

in past distribute empty database jar using derby package.

any ideas?

thank much!

i'm not sure understood question possible package read-only database inside jar. derby documentation:

accessing databases-in-a-jar in class path

once archive containing 1 or more derby databases has been created can placed in class path. allows access database within application without application's knowing path of archive. when jar or zip files part of class path, not have specify jar subsubprotocol connect them.

to access database in zip or jar file in class path:

  1. set class path include jar or zip file before starting derby:

    classpath="c:\dbs.jar;%classpath%" 
  2. connect database within jar or zip file 1 of following connection urls:

    jdbc:derby:/databasepathwithinarchive  (standard syntax)  jdbc:derby:classpath:/databasepathwithinarchive  (syntax subsubprotocol) 

for example:

jdbc:derby:/products/boiledfood jdbc:derby:classpath:/products/boiledfood 

if doesn't answer question, please clarify.


Comments

Popular posts from this blog

c++ - How do I get a multi line tooltip in MFC -

asp.net - In javascript how to find the height and width -

c# - DataTable to EnumerableRowCollection -