public String selectOption ( final String optionName , final String defaultValue ) throws SQLException { Connection conn = null ; PreparedStatement stmt = null ; ResultSet rs = null ; Timer . Context ctx = metrics . optionSelectTimer . time ( ) ; try { conn = connectionSupplier . getConnection ( ) ; stmt = conn . prepareStatement ( selectOptionSQL ) ; stmt . setString ( 1 , optionName ) ; rs = stmt . executeQuery ( ) ; if ( rs . next ( ) ) { String val = rs . getString ( 1 ) ; return val != null ? val . trim ( ) : defaultValue ; } else { return defaultValue ; } } finally { ctx . stop ( ) ; SQLUtil . closeQuietly ( conn , stmt , rs ) ; } }
Gets a configuration option with a default value .