@ CheckReturnValue public static Builder fromJndi ( final Context context , final String lookupKey , Flavor flavor ) { Options options = new OptionsDefault ( flavor ) ; return new BuilderImpl ( null , ( ) -> { DataSource ds ; try { ds = ( DataSource ) context . lookup ( lookupKey ) ; } catch ( Exception e ) { throw new DatabaseException ( "Unable to locate the DataSource in JNDI using key " + lookupKey , e ) ; } try { return ds . getConnection ( ) ; } catch ( Exception e ) { throw new DatabaseException ( "Unable to obtain a connection from JNDI DataSource " + lookupKey , e ) ; } } , options ) ; }
Builder method to create and initialize an instance of this class using a JNDI resource . To use this method you must explicitly indicate what Flavor of database we are dealing with .