public static DataSource createDataSource ( String source , String jndiName ) { DataSource ds = createDataSource ( source ) ; if ( ds != null && jndiName != null ) { InitialContext ic ; try { ic = new InitialContext ( ) ; ic . bind ( jndiName , ds ) ; } catch ( NamingException e ) { log . error ( "Failed to bind data source '" + source + "' to JNDI name: " + jndiName , e ) ; } } return ds ; }
Create DataSource and bind it to JNDI