I am attempting to run the Apache Derby db from the memory stick. I replicated the appropriate .jar files and handled to begin in the network server. But exactly how to I specify the bond URL in hooking up towards the server? the database is incorporated in the memory stick called G.

Used the next code, but discovered the best:

     DriverManager.getConnection("jdbc:derby://localhost:1527");

java.sql.SQLException: The URL 'jdbc:derby://localhost:1527' isn't correctly created.

How do i connect and employ it like a normal database?

Thanks!

The existence of the memory stick is immaterial for this question. Probably the most pertinent point is whether or not the Derby server is running within the embedded mode or perhaps in the network server mode.

In the URL used, it seems that you want to connect with Derby running like a network server. This could be if you have began Derby while using startNetworkServer spend scripts, obtainable in the Derby installation. If that's the case, the connection URL format, as defined within the Derby documentation is really as proven below. Note the existence of the databaseName parameter, that is missing within the URL published within the question.

jdbc:derby://server[:port]/databaseName[;attributeKey=value]..

Should you did not wish to start Derby within the network server mode, but rather being an embedded database, then your connection URL format differs. Note the lack of the main harbour number, and also the reliance upon a subprotocol whose value is one of directory, classpath or jar. Examples of this format can be found within the documentation.

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