/** * @return * @throws SQLException */ public Connection getConnection() throws SQLException { Connection con = DriverManager.getConnection( properties.getDbUrl(), properties.getUsername(), properties.getPassword()); return con; }
private void init() { properties = DbResourceUtil.getDbProperties(); try { Class.forName(properties.getDriverClass()); } catch (ClassNotFoundException e) { e.printStackTrace(); } }
/** * @param userName * @param password * @return * @throws SQLException */ public Connection getConnection(String userName, String password) throws SQLException { Connection con = DriverManager.getConnection(properties.getDbUrl(), userName, password); return con; }