After an application has loaded the appropriate driver, it can establish a connection to the database. To connect to an embedded Apache Derby database, use the following getConnection() method:
Connection conn = null; conn = DriverManager.getConnection("jdbc:derby:YMLD");
The getConnection URL takes the form jdbc:derby:[subprotocol:][databasename][;attributes].
subprotocol is rarely used in the connection URL. This option specifies where Apache Derby should look for a database. This can be in a directory, a class path, or in a .JAR file. The majority of the time, this option is used for read-only databases.
databasename specifies a database name, with or without a relative or absolute path.
attributes specifies ...