code: @Override
    public ICloudSpannerConnection getConnection() throws SQLException {
      if (con == null) {
        // Before throwing the exception, let's notify the registered
        // listeners about the error
        SQLException sqlException = new CloudSpannerSQLException(
            "This PooledConnection has already been closed.", Code.FAILED_PRECONDITION);
        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()) {
            rollbackAndIgnoreException();
          }
          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;
  
      ICloudSpannerConnection proxyCon =
          (ICloudSpannerConnection) Proxy.newProxyInstance(getClass().getClassLoader(),
              new Class[] {Connection.class, ICloudSpannerConnection.class}, handler);
      last.setProxy(proxyCon);
      return proxyCon;
    }
docs: Gets a handle for a client to use. This is a wrapper around the physical connection, so the
  client can call close and it will just return the connection to the pool without really closing
  the physical connection.
  
  <p>
  According to the JDBC 2.0 Optional Package spec (6.2.3), only one client may have an active
  handle to the connection at a time, so if there is a previous handle active when this is
  called, the previous one is forcibly closed and its work rolled back.
  </p>