private Connection getConnectionFromDriverManager ( String dbDriverClassName , String dbUrlStr , String userName , String password , String propertiesString ) throws SQLException { Connection con = null ; try { Class . forName ( dbDriverClassName ) ; if ( ! EMPTY_STRING . equals ( userName ) ) { con = DriverManager . getConnection ( dbUrlStr , userName , password ) ; } else if ( ! EMPTY_STRING . equals ( propertiesString ) ) { Properties props = parseProperties ( propertiesString ) ; if ( props == null ) { throw new ControlException ( "Invalid properties annotation value: " + propertiesString ) ; } con = DriverManager . getConnection ( dbUrlStr , props ) ; } else { con = DriverManager . getConnection ( dbUrlStr ) ; } } catch ( ClassNotFoundException e ) { throw new ControlException ( "Database driver class not found!" , e ) ; } return con ; }
Get a JDBC connection from the DriverManager .