private Connection getDerbyConnection(String wkpDir) {
		// See your driver documentation for the proper format of this string :
		wkpDir = wkpDir.replaceAll("\\\\", "/");
		System.err.println(wkpDir);
		String DB_CONN_STRING = "jdbc:derby:" + wkpDir // "d:/workspace/workspace-next-work/nextreports-server/data/workspaces/default"
				+ "/db;create=false";
		// Provided by your driver documentation. In this case, a MySql driver
		// is used :

		String DRIVER_CLASS_NAME = "org.apache.derby.jdbc.EmbeddedDriver";
		String USER_NAME = null;
		String PASSWORD = null;

		Connection result = null;
		try {
			Class.forName(DRIVER_CLASS_NAME).newInstance();
		} catch (Exception ex) {
			LOG.debug("Check classpath. Cannot load db driver: " + DRIVER_CLASS_NAME);
		}

		try {
			result = DriverManager.getConnection(DB_CONN_STRING, USER_NAME, PASSWORD);
		} catch (SQLException e) {
			LOG.debug("Driver loaded, but cannot connect to db: " + DB_CONN_STRING);
		}
		return result;
	}
private Connection getDerbyConnection ( String wkpDir ) { wkpDir = wkpDir . replaceAll ( "\\\\" , "/" ) ; System . err . println ( wkpDir ) ; String DB_CONN_STRING = "jdbc:derby:" + wkpDir + "/db;create=false" ; String DRIVER_CLASS_NAME = "org.apache.derby.jdbc.EmbeddedDriver" ; String USER_NAME = null ; String PASSWORD = null ; Connection result = null ; try { Class . forName ( DRIVER_CLASS_NAME ) . newInstance ( ) ; } catch ( Exception ex ) { LOG . debug ( "Check classpath. Cannot load db driver: " + DRIVER_CLASS_NAME ) ; } try { result = DriverManager . getConnection ( DB_CONN_STRING , USER_NAME , PASSWORD ) ; } catch ( SQLException e ) { LOG . debug ( "Driver loaded, but cannot connect to db: " + DB_CONN_STRING ) ; } return result ; }
Uses DriverManager.