예제 #1
0
 /**
  * Jdbc connection pooling of MMBase would kill the statement if too duratious. This produces a
  * 'direct connection' in that case, to circumvent that problem (Indexing queries _may_ take a
  * while).
  */
 protected Connection getDirectConnection() throws SQLException {
   directConnections++;
   try {
     if (dataSource instanceof GenericDataSource) {
       return ((GenericDataSource) dataSource).getDirectConnection();
     } else {
       return dataSource.getConnection();
     }
   } catch (SQLException sqe) {
     log.error("With direct connection #" + directConnections + ": " + sqe.getMessage());
     throw sqe;
   } catch (Throwable t) {
     throw new RuntimeException("direct connection #" + directConnections, t);
   }
 }