Ejemplo n.º 1
0
 public DataSource createDataSource(Properties properties, Context context, boolean XA)
     throws Exception {
   PoolConfiguration poolProperties = DataSourceFactory.parsePoolProperties(properties);
   if (poolProperties.getDataSourceJNDI() != null && poolProperties.getDataSource() == null) {
     performJNDILookup(context, poolProperties);
   }
   org.apache.tomcat.jdbc.pool.DataSource dataSource =
       XA
           ? new org.apache.tomcat.jdbc.pool.XADataSource(poolProperties)
           : new org.apache.tomcat.jdbc.pool.DataSource(poolProperties);
   // initialise the pool itself
   dataSource.createPool();
   // Return the configured DataSource instance
   return dataSource;
 }