code: public Connection getConnection() throws LookupException
      {
          /*
          if the connection is not null and we are not in a local tx, we check
          the connection state and release "dead" connections.
          if connection is in local tx we do nothing, the dead connection will cause
          an exception and PB instance have to handle rollback
          */
          if(con != null && !isInLocalTransaction() && !isAlive(con))
          {
              releaseConnection();
          }
          if (con == null)
          {
              con = this.connectionFactory.lookupConnection(jcd);
              if (con == null) throw new PersistenceBrokerException("Cannot get connection for " + jcd);
              if (jcd.getUseAutoCommit() == JdbcConnectionDescriptor.AUTO_COMMIT_SET_TRUE_AND_TEMPORARY_FALSE)
              {
                  try
                  {
                      this.originalAutoCommitState = con.getAutoCommit();
                  }
                  catch (SQLException e)
                  {
                      throw new PersistenceBrokerException("Cannot request autoCommit state on the connection", e);
                  }
              }
              if (log.isDebugEnabled()) log.debug("Request new connection from ConnectionFactory: " + con);
          }
  
          if (isBatchMode())
          {
              if (batchCon == null)
              {
                  batchCon = new BatchConnection(con, broker);
              }
              return batchCon;
          }
          else
          {
              return con;
          }
      }
docs: Returns the underlying connection, requested from
  {@link org.apache.ojb.broker.accesslayer.ConnectionFactory}.
  <p>
  PB#beginTransaction() opens a single jdbc connection via
  PB#serviceConnectionManager().localBegin().
  If you call PB#serviceConnectionManager().getConnection() later
  it returns the already opened connection.
  The PB instance will release the used connection during
  PB#commitTransaction() or PB#abortTransaction() or PB#close().
  </p>
  <p>
  NOTE: Never call Connection.close() on the connection requested from the ConnectionManager.
  Cleanup of used connection is done by OJB itself. If you need to release a used connection
  call {@link #releaseConnection()}.
  </p>