Getting a Database Connection – Database Connectivity
Getting a Database Connection To create a connection to a Derby database, the following code can be emulated: Click here to view code image String jdbcURL = “jdbc:derby:localhost:1521:musicDB”;String username = “joe”;String password = “welcome1”;try (Connection connection = DriverManager.getConnection(jdbcURL, username, password)) { /* use the connection. */} catch (SQLException e) { e.printStackTrace();} A portion of the