Class RemoteJdbcConfig<T extends RemoteJdbcConfig<?>>

java.lang.Object
de.chojo.sqlutil.jdbc.JdbcConfig<T>
de.chojo.sqlutil.jdbc.RemoteJdbcConfig<T>
Direct Known Subclasses:
MariaDbJdbc, MySQLJdbc, PostgresJdbc

public abstract class RemoteJdbcConfig<T extends RemoteJdbcConfig<?>> extends JdbcConfig<T>
  • Constructor Details

    • RemoteJdbcConfig

      public RemoteJdbcConfig()
  • Method Details

    • localhost

      public T localhost()
      Sets the host explicit to local host.

      This is usually the default value defined by jdbc drivers.

      Returns:
      builder instance
    • host

      public T host(String host)
      Set the host name of the connection
      Parameters:
      host - host
      Returns:
      builder instance
    • ipv4

      public T ipv4(String ipv4)
      Sets the host to an ipv4 address. This address must be a valid ipv4 address
      Parameters:
      ipv4 - ipv4 address
      Returns:
      builder instance
      Throws:
      IllegalArgumentException - when an invalid ipv4 was passed
    • ipv6

      public T ipv6(String ipv6)
      Sets the host to an ipv6 address.

      This address must be a valid ipv6 address.

      The method will ensure that the ipv6 address is surrounded by [...], which is required by jdbc.

      Parameters:
      ipv6 - ipv6 address
      Returns:
      builder instance
      Throws:
      IllegalArgumentException - when an invalid ipv6 was passed
    • port

      public T port(String port)
      Set the port.
      Parameters:
      port - port
      Returns:
      builder instance
      Throws:
      IllegalArgumentException - when the port is not a number
      IllegalArgumentException - when the port is smaller than 1 or larger than 65535
    • port

      public T port(int port)
      Set the port.
      Parameters:
      port - port
      Returns:
      builder instance
      Throws:
      IllegalArgumentException - when the port is smaller than 1 or larger than 65535
    • database

      public T database(String database)
      Sets the database for the connection.

      Most drivers default to the username if not entered.

      Parameters:
      database - database
      Returns:
      builder instance
    • baseUrl

      protected String baseUrl()
      Description copied from class: JdbcConfig
      Returns the base url without parameter
      Specified by:
      baseUrl in class JdbcConfig<T extends RemoteJdbcConfig<?>>
      Returns:
      base url
    • login

      public T login(String user, String password)
    • password

      public T password(String password)
      Sets the password for the connection.
      Parameters:
      password - password
      Returns:
      builder instance
    • user

      public T user(String user)
      Sets the user for the connection.
      Parameters:
      user - user
      Returns:
      builder instance