Accessing a read-only database in a zip/jar file

To access a database in a zip/jar, you specify the 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.

Related concepts
Databases on read-only media and DatabaseMetaData
Related tasks
Creating and preparing the database for read-only use
Deploying the database on the read-only media
Transferring read-only databases to archive (jar or zip) files