/**
   * Returns a ConnectionProxy.
   *
   * @throws SQLException if an error occurs
   */
  public synchronized Connection getConnection() throws SQLException {
    if (_connection == null) {
      fireConnectionEvent(false, new SQLException(Messages.get("error.jdbcx.conclosed"), "08003"));

      return null;
    }

    if (_connectionProxy != null) {
      _connectionProxy.close();
    }

    // Sould the SQLException be captured here for safety in the future even though
    // no SQLException is being thrown by the ConnectionProxy at the moment???
    _connectionProxy = new ConnectionProxy(this, _connection);

    return _connectionProxy;
  }