static JDBConnection createConnection ( final String connectionName , final Config baseConfig , final Config globalPropertyConfig ) throws InitializationException { Config connectionRef = ConfigFactory . load ( ) . getObject ( "acp.defaults.connection" ) . toConfig ( ) ; Config config = baseConfig . withFallback ( connectionRef ) ; final String user = getString ( config , "user" ) ; final String password = getString ( config , "password" ) ; final String testSQL = getString ( config , "testSQL" , "" ) ; String connectionString = getString ( config , "connectionString" ) ; final boolean debug = getString ( config , "debug" , "false" ) . equalsIgnoreCase ( "true" ) ; final long createTimeoutMillis = getMilliseconds ( config , "createTimeout" ) ; final long testIntervalMillis = getMilliseconds ( config , "testInterval" ) ; String propsRef = getString ( config , "properties" , "" ) ; Config propsConfig ; if ( propsRef . length ( ) > 0 ) { if ( globalPropertyConfig . hasPath ( propsRef ) ) { propsConfig = globalPropertyConfig . getObject ( propsRef ) . toConfig ( ) ; } else { throw new InitializationException ( "The referenced global properties, '" + propsRef + "' is not defined" ) ; } connectionString = buildConnectionString ( connectionString , propsConfig ) ; } return new JDBConnection ( connectionName , user , password , connectionString , createTimeoutMillis , testSQL . length ( ) > 0 ? testSQL : null , testIntervalMillis , debug ) ; }
Creates a connection from properties .