DBA > Job Interview Questions > DERBY Java Database FAQs

How to accessing a Read-Only Database in a Zip/J

More DBA job interview questions and answers at http://dba.fyicenter.com/Interview-Questions/

(Continued from previous question...)

How to accessing a Read-Only Database in a Zip/Jar?

To access a database in a zip/jar, you specify jar in the subsubprotocol:
jdbc:derby:jar:(pathToArchive)databasePathWithinArchive
The pathToArchive is the absolute path to the archive file. The databasePathWithinArchive is the relative path to the database within the archive. For example:

jdbc:derby:jar:(C:/dbs.jar)products/boiledfood
jdbc:derby:jar:(C:/dbs.jar)sales

If you have trouble finding a database within an archive, check the contents of the archive using your archive tool. The databasePathWithinArchive must match the one in the archive. You might find that the path in the archive has a leading slash, and thus the URL would be:
jdbc:derby:jar:(C:/dbs.jar)/products/boiledfood
Databases in a jar or zip file are always opened read-only and there is currently no support to allow updates of any type.
Databases in a jar or zip file are not booted automatically when Derby is started, unless they are explicitly listed as derby.service properties.

(Continued on next question...)

Other Job Interview Questions