Search code examples
jdbcderbyjavadboracle-sqldeveloper

Connecting to an Apache Derby/JavaDB database using Oracle SQL Developer


I've been trying to connect to an Apache Derby/JavaDB embedded database using Oracle SQL Developer but without much success.

I've tried to create a new connection using the following JDBC URL:

jdbc:derby:/path/to/file/database.derby;create=true

which resulted in an error:

Status : Failure -Test failed: Invalid connection info specified. Verify the URL format for the specified driver.

Previously I've added derby.jar through Tools > Preferences > Database > Third Party JDBC Drivers.

Given that JavaDB is now a supported Oracle product I'm not understanding why is not better integrated with its development tools.

Any guidance will be much appreciated. Thanks in advance.


Solution

  • Your derby url seems wrong. You need to point the url to the directory of the database, not the database itself.

    jdbc:derby:/path/to/file/;create=true
    

    Have a look at the examples.

    jdbc:derby:/reference/phrases/french

    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. If a jar file storing databases were in the user's classpath, this could also be a path within the jar file.

    From the docs:

    The connection URL syntax is as follows:

    jdbc:derby:[subsubprotocol:][databaseName][;attribute=value]

    Subsubprotocol, which is not typically specified, determines how Derby looks for a database: in a directory, in memory, in a class path, or in a jar file. Subsubprotocol is one of the following:

    directory: The default. Specify this explicitly only to distinguish a database that might be ambiguous with one on the class path.