The examples in this section use the syntax of the connection URL for use in an embedded environment.
This information also applies to the client connection URL in a client/server environment. For reference information about client connection URLs, see "java.sql.Connection interface" in the Derby Reference Manual.
Open a connection to the database db1. db1 is a directory located in the system directory.
Open a connection to the database london/sales. london is a subdirectory of the system directory, and sales is a subdirectory of the directory london.
Open a connection to the database /reference/phrases/french.
On a UNIX system, this would be the path of the directory. On a Windows system, the path would be C:\reference\phrases\french if the current drive were C.
Open a connection to the database stored in the directory \demo\sample on drive A (usually the floppy drive) on a Windows system.
These two connection URLs connect to the same database, salesdb, on a Windows platform if the system directory of the Derby system is C:\databases.
Create the database support/bugsdb in the system directory, automatically creating the intermediate directory support if it does not exist.
Shut down the sample database. (Authentication is not enabled, so no user credentials are required.)
Access the in-memory database named myDB. The syntax for a client connection URL is different; see Using in-memory databases for details.
Access myDB (which is directly in a directory in the classpath) as a read-only database.
Access the read-only database boiledfood in the products directory from the jar file C:/dbs.jar.
Access myDB, which is in the system directory.