MyJDBCConnection { public static void initConnection(boolean create) throws AdeException { if (connectionUrl == null) { final IAdeConfigProperties properties = Ade.getAde().getConfigProperties(); MyJDBCConnection.connectionUrl = properties.database().getDatabaseUrl(); MyJDBCConnection.dbUser = properties.database().getDatabaseUser(); MyJDBCConnection.dbPassword = properties.database().getDatabasePassword(); } String url = connectionUrl; if (create && connectionUrl !=null && connectionUrl.contains("jdbc:derby")) { url += ";create=true"; } logger.info("Connecting to database " + connectionUrl); try { synchronized (MyJDBCConnection.class) { if (dbUser == null || dbUser.isEmpty()) { setConnection(DriverManager.getConnection(url)); } else { setConnection(DriverManager.getConnection(url, dbUser, dbPassword)); } threadConnectionTime.set(renewConnectionTime); } logger.info("Thread " + Thread.currentThread().getName() + " using Connection object " + projectCon.get()); } catch (SQLException e) { throw new AdeInternalException("Failed obtaining connection", e); } } private  MyJDBCConnection(); static synchronized void setDbConnectionProperties(String connectionUrl,
            String dbUser, String dbPassword); static void initConnection(boolean create); static Connection getConnection(); static void close(); static synchronized void flagForRenewal(); static void setConnection(Connection conn);  }
@Test(expected = AdeInternalException.class) public void testInitConnectionWithoutCreateThrowsMIEIfDatabaseDoesNotExists() throws Exception { MyJDBCConnection.initConnection(false); }