code: public void setNetworkTimeout(Executor executor, final int milliseconds) throws SQLException {
      if (this.isClosed()) {
        throw ExceptionMapper
            .getSqlException("Connection.setNetworkTimeout cannot be called on a closed connection");
      }
      if (milliseconds < 0) {
        throw ExceptionMapper
            .getSqlException("Connection.setNetworkTimeout cannot be called with a negative timeout");
      }
      SQLPermission sqlPermission = new SQLPermission("setNetworkTimeout");
      SecurityManager securityManager = System.getSecurityManager();
      if (securityManager != null) {
        securityManager.checkPermission(sqlPermission);
      }
      try {
        stateFlag |= ConnectionState.STATE_NETWORK_TIMEOUT;
        protocol.setTimeout(milliseconds);
      } catch (SocketException se) {
        throw ExceptionMapper.getSqlException("Cannot set the network timeout", se);
      }
    }
docs: Change network timeout.
  
  @param executor     executor (can be null)
  @param milliseconds network timeout in milliseconds.
  @throws SQLException if security manager doesn't permit it.