# Accessing databases from the classpath/modulepath

In most cases, you access databases from the file system. However, it is also possible to access databases from the classpath/modulepath. The databases can be archived into a jar or zip file or left as is.

All such databases are read-only.

To access an unarchived database from the classpath, use the classpath subsubprotocol.

For example, for a database called sample in C:\derby\demo\databases, you can put the C:\derby\demo\databases directory in the classpath and access sample like this:

    jdbc:derby:classpath:sample

If only C:\derby were in the classpath/modulepath, you could access sample (read-only) like this:

    jdbc:derby:classpath:demo/databases/sample

Parent topic: Special database access
Related concepts
Accessing databases from a jar or zip file