docs: @Override
    public Connection getConnection() throws SQLException {
      if (con == null) {
        // Before throwing the exception, let's notify the registered listeners about the error
        PSQLException sqlException =
            new PSQLException(GT.tr("This PooledConnection has already been closed."),
                PSQLState.CONNECTION_DOES_NOT_EXIST);
        fireConnectionFatalError(sqlException);
        throw sqlException;
      }
      // If any error occurs while opening a new connection, the listeners
      // have to be notified. This gives a chance to connection pools to
      // eliminate bad pooled connections.
      try {
        // Only one connection can be open at a time from this PooledConnection. See JDBC 2.0 Optional
        // Package spec section 6.2.3
        if (last != null) {
          last.close();
          if (!con.getAutoCommit()) {
            try {
              con.rollback();
            } catch (SQLException ignored) {
            }
          }
          con.clearWarnings();
        }
        /*
         * In XA-mode, autocommit is handled in PGXAConnection, because it depends on whether an
         * XA-transaction is open or not
         */
        if (!isXA) {
          con.setAutoCommit(autoCommit);
        }
      } catch (SQLException sqlException) {
        fireConnectionFatalError(sqlException);
        throw (SQLException) sqlException.fillInStackTrace();
      }
      ConnectionHandler handler = new ConnectionHandler(con);
      last = handler;
  
      Connection proxyCon = (Connection) Proxy.newProxyInstance(getClass().getClassLoader(),
          new Class[]{Connection.class, PGConnection.class}, handler);
      last.setProxy(proxyCon);
      return proxyCon;
    }