private String findDriverByUrlImpl(String url) { for (int i = 0; i < _driverList.size(); i++) { try { Driver driver = (Driver) _driverList.get(i); if (driver.acceptsURL(url)) return driver.getClass().getName(); } catch (Exception e) { log.log(Level.FINE, e.toString(), e); } } return null; }
/** * Fires a new connection event on all listeners. * * @param closed <code>true</code> if <code>close</code> has been called on the connection; <code> * false</code> if the <code>sqlException</code> represents an error where the connection may * not longer be used. * @param sqlException the SQLException to pass to the listeners */ public synchronized void fireConnectionEvent(boolean closed, SQLException sqlException) { if (_listeners.size() > 0) { ConnectionEvent connectionEvent = new ConnectionEvent(this, sqlException); Iterator iterator = _listeners.iterator(); while (iterator.hasNext()) { ConnectionEventListener listener = (ConnectionEventListener) iterator.next(); if (closed) { listener.connectionClosed(connectionEvent); } else { listener.connectionErrorOccurred(connectionEvent); } } } }
/** * Fires a new connection event on all listeners. * * @param closed <code>true</code> if <code>close</code> has been called on the connection; <code> * false</code> if the <code>sqlException</code> represents an error where the connection may * not longer be used. * @param sqlException the SQLException to pass to the listeners */ public synchronized void fireConnectionEvent(boolean closed, SQLException sqlException) { if (listeners.size() > 0) { ConnectionEvent connectionEvent = new ConnectionEvent(this, sqlException); Iterator iterator = listeners.iterator(); while (iterator.hasNext()) { ConnectionEventListener listener = (ConnectionEventListener) iterator.next(); if (closed) { listener.connectionClosed(connectionEvent); } else { try { if (connection == null || connection.isClosed()) { listener.connectionErrorOccurred(connectionEvent); } } catch (SQLException ex) { // Will never occur } } } } }