Esempio n. 1
0
 static void display(ComboPooledDataSource cpds) throws Exception {
   System.err.println("numConnections: " + cpds.getNumConnections());
   System.err.println("numBusyConnections: " + cpds.getNumBusyConnections());
   System.err.println("numIdleConnections: " + cpds.getNumIdleConnections());
   System.err.println(
       "numUnclosedOrphanedConnections: " + cpds.getNumUnclosedOrphanedConnections());
   System.err.println();
 }
 public Connection getConnection(AccessConfiguration configuration) throws DAOException {
   init(configuration);
   Connection connection = null;
   try {
     if (logger.isTraceEnabled()) logger.trace("Getting connection from pool ");
     if (logger.isTraceEnabled()) logger.trace("    getMaxPoolSize: " + cpds.getMaxPoolSize());
     if (logger.isTraceEnabled())
       logger.trace("    getNumConnections: " + cpds.getNumConnections());
     if (logger.isTraceEnabled())
       logger.trace("    getNumBusyConnections: " + cpds.getNumBusyConnections());
     connection = cpds.getConnection();
     if (logger.isTraceEnabled()) logger.trace("Opened connections: " + cpds.getNumConnections());
   } catch (SQLException sqle) {
     close(connection);
     throw new DAOException(
         " getConnection: "
             + sqle
             + "\n\ndriver: "
             + configuration.getDriver()
             + " - uri: "
             + configuration.getUri()
             + " - login: "******" - password: "******"\n");
   }
   if (connection == null) {
     throw new DAOException(
         "Connection is NULL !"
             + "\n\ndriver: "
             + configuration.getDriver()
             + " - uri: "
             + configuration.getUri()
             + " - login: "******" - password: "******"\n");
   }
   return connection;
 }
Esempio n. 3
0
  /**
   * Get Status
   *
   * @return status info
   */
  @Override
  public String getStatus() {
    if (m_ds == null) {
      return null;
    }

    StringBuffer sb = new StringBuffer();
    try {
      sb.append("# Connections: ").append(m_ds.getNumConnections());
      sb.append(" , # Busy Connections: ").append(m_ds.getNumBusyConnections());
      sb.append(" , # Idle Connections: ").append(m_ds.getNumIdleConnections());
      sb.append(" , # Orphaned Connections: ").append(m_ds.getNumUnclosedOrphanedConnections());
    } catch (Exception e) {
    }
    return sb.toString();
  } //  getStatus
Esempio n. 4
0
 /**
  * String Representation
  *
  * @return info
  */
 @Override
 public String toString() {
   StringBuffer sb = new StringBuffer("DB_Oracle[");
   sb.append(m_connectionURL);
   try {
     StringBuffer logBuffer = new StringBuffer(50);
     logBuffer.append("# Connections: ").append(m_ds.getNumConnections());
     logBuffer.append(" , # Busy Connections: ").append(m_ds.getNumBusyConnections());
     logBuffer.append(" , # Idle Connections: ").append(m_ds.getNumIdleConnections());
     logBuffer
         .append(" , # Orphaned Connections: ")
         .append(m_ds.getNumUnclosedOrphanedConnections());
   } catch (Exception e) {
     sb.append("=").append(e.getLocalizedMessage());
   }
   sb.append("]");
   return sb.toString();
 } //  toString
Esempio n. 5
0
 public int getNumConnections(String username, String password) throws SQLException {
   return combods.getNumConnections(username, password);
 }