background image
<< java.sql.Driver.getPropertyInfo method | Attributes of the Derby database connection URL >>

Derby database connection URL syntax

<< java.sql.Driver.getPropertyInfo method | Attributes of the Derby database connection URL >>
Derby Reference Manual
304
authentication is enabled. User names are passed to Derby as authorization identifiers,
which are used to determine whether the user is authorized for access to the database
and for determining the default schema. When the connection is established, if no user
is supplied, Derby sets the default user to APP, which Derby uses to name the default
schema. If a user is supplied, the default schema is the same as the user name.
Derby database connection URL syntax
A Derby database connection URL consists of the basic database connection URL
followed by an optional subsubprotocol and optional attributes.
This section provides reference information only. For a more complete description,
including examples, see "Connecting to Databases" in Chapter 1 of the Derby
Developer's Guide
.
Syntax of database connection URLs for applications with embedded databases
For applications with embedded databases, the syntax of the database connection URL
is
jdbc:derby: [subsubprotocol:][databasename][;attributes]*
· jdbc:derby:
In JDBC lingo, derby is the subprotocol for connecting to a Derby database. The
subprotocol is always derby and does not vary.
· subsubprotocol:
subsubprotocol, which is not typically specified, specifies where Derby looks for
a database: in a directory, in a classpath, or in a jar file. It is used only in rare
instances, usually for read-only databases. subsubprotocol is one of the following:
· directory
· classpath: Databases are treated as read-only databases, and all
databaseNames must begin with at least a slash, because you specify them
"relative" to the classpath directory or archive. (You do not have to specify
classpath as the subsubprotocol; it is implied.)
· jar Databases are treated as read-only databases.
jar: requires an additional element immediately before the databaseName:
(pathToArchive)
pathToArchive is the path to the jar or zip file that holds the database and includes
the name of the jar or zip file.
See the Derby Developer's Guide for examples of database connection URLs for
read-only databases.
· databaseName
Specify the databaseName to connect to an existing database or a new one.
You can specify the database name alone, or with a relative or absolute path. See
"Standard Connections-Connecting to Databases in the File System" in Chapter 1
of the Derby Developer's Guide.
· attributes
Specify 0 or more database connection URL attributes as detailed in
Attributes of
the Derby database connection URL
.
Additional SQL syntax