Here you can find the source of getConnection(String dbName)
public static Connection getConnection(String dbName)
//package com.java2s; //License from project: Apache License import java.sql.Connection; import java.sql.DriverManager; import java.sql.SQLException; public class Main { private static final String DRIVER = "org.apache.derby.jdbc.EmbeddedDriver"; private static final String PROTOCOL = "jdbc:derby:"; public static Connection getConnection(String dbName) { try {/*www. j a va2 s . c o m*/ Class.forName(DRIVER); } catch (ClassNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } try { return DriverManager.getConnection(PROTOCOL + dbName + ";create=true"); } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } return null; } }