Package org.h2.table

Class TableLinkConnection

java.lang.Object
org.h2.table.TableLinkConnection

public class TableLinkConnection extends Object
A connection for a linked table. The same connection may be used for multiple tables, that means a connection may be shared.
  • Field Details

    • map

      The map where the link is kept.
    • driver

      private final String driver
      The connection information.
    • url

      private final String url
      The connection information.
    • user

      private final String user
      The connection information.
    • password

      private final String password
      The connection information.
    • conn

      private Connection conn
      The database connection.
    • useCounter

      private int useCounter
      How many times the connection is used.
    • autocommit

      private boolean autocommit
  • Constructor Details

  • Method Details

    • open

      public static TableLinkConnection open(HashMap<TableLinkConnection,TableLinkConnection> map, String driver, String url, String user, String password, boolean shareLinkedConnections)
      Open a new connection.
      Parameters:
      map - the map where the connection should be stored (if shared connections are enabled).
      driver - the JDBC driver class name
      url - the database URL
      user - the user name
      password - the password
      shareLinkedConnections - if connections should be shared
      Returns:
      a connection
    • open

      private void open()
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • getConnection

      Connection getConnection()
      Get the connection. This method and methods on the statement must be synchronized on this object.
      Returns:
      the connection
    • close

      void close(boolean force)
      Closes the connection if this is the last link to it.
      Parameters:
      force - if the connection needs to be closed even if it is still used elsewhere (for example, because the connection is broken)
    • setAutoCommit

      public void setAutoCommit(boolean mode)
      Specify if the autocommit mode is activated or not
      Parameters:
      mode - to set
    • getAutocommit

      public boolean getAutocommit()
      The autocommit mode
      Returns:
      true if autocommit is on