Class ClientInfo

java.lang.Object
is.codion.common.db.database.ClientInfo

public final class ClientInfo extends Object

Identifies the client on whose behalf a database connection is being used, for Database.clientInfo(java.sql.Connection, ClientInfo).

Note that user() is the application's user, not the database user. The two coincide only when clients log in to the database directly; the whole point of carrying this is the case where they do not, and the database would otherwise see nothing but the shared user every client shares.

  • Constructor Details

    • ClientInfo

      public ClientInfo(String user, String clientType, @Nullable String host)
      Parameters:
      user - the application user the connection is being used on behalf of
      clientType - the client type
      host - the host the client is running on, null if unknown
  • Method Details

    • user

      public String user()
      Returns:
      the application user, not the database user
    • clientType

      public String clientType()
      Returns:
      the client type
    • host

      public Optional<String> host()
      Returns:
      the client host, an empty Optional if unknown
    • equals

      public boolean equals(Object object)
      Overrides:
      equals in class Object
    • hashCode

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

      public String toString()
      Overrides:
      toString in class Object