public static Connection getConnection ( final String jndiName ) throws FactoryException { Validate . notBlank ( jndiName , "The validated character sequence 'jndiName' is null or empty" ) ; // no need for defensive copies of Strings try { return DataSourceFactory . getDataSource ( jndiName ) . getConnection ( ) ; } catch ( SQLException e ) { final String error = "Error retrieving JDBC connection from JNDI: " + jndiName ; LOG . warn ( error ) ; throw new FactoryException ( error , e ) ; } }
Return a Connection instance for a JNDI managed JDBC connection .