public MariaDbConnection getConnection ( String username , String password ) throws SQLException { try { if ( ( urlParser . getUsername ( ) != null ? urlParser . getUsername ( ) . equals ( username ) : username == null ) && ( urlParser . getPassword ( ) != null ? urlParser . getPassword ( ) . equals ( password ) : password == null ) ) { return getConnection ( ) ; } UrlParser tmpUrlParser = ( UrlParser ) urlParser . clone ( ) ; tmpUrlParser . setUsername ( username ) ; tmpUrlParser . setPassword ( password ) ; Protocol protocol = Utils . retrieveProxy ( tmpUrlParser , globalInfo ) ; return new MariaDbConnection ( protocol ) ; } catch ( CloneNotSupportedException cloneException ) { //cannot occur throw new SQLException ( "Error getting connection, parameters cannot be cloned" , cloneException ) ; } }
Get new connection from pool if user and password correspond to pool . If username and password are different from pool will return a dedicated connection .