Class PostgresJdbc


public class PostgresJdbc extends RemoteJdbcConfig<PostgresJdbc>
  • Constructor Details

    • PostgresJdbc

      public PostgresJdbc()
  • Method Details

    • driver

      public String driver()
      Description copied from class: JdbcConfig
      Returns the driver name of the jdbc url
      Specified by:
      driver in class JdbcConfig<PostgresJdbc>
      Returns:
      driver
    • connectTimeout

      public PostgresJdbc connectTimeout(int millis)
      The connect timeout value, in milliseconds, or zero for no timeout. Default: 30 000.
      Parameters:
      millis - milliseconds
      Returns:
      builder instance
    • ssl

      public PostgresJdbc ssl(boolean ssl)
      Connect using SSL. The server must have been compiled with SSL support. This property does not need a value associated with it. The mere presence of it specifies a SSL connection. However, for compatibility with future versions, the value "true" is preferred. For more information see Chapter 4, Using SSL.
      Parameters:
      ssl - ssl mode.
      Returns:
      builder instance
    • sslFactory

      public PostgresJdbc sslFactory(String sslFactory)
      The provided value is a class name to use as the SSLSocketFactory when establishing a SSL connection. For more information see the section called Custom SSLSocketFactory”. defaults to LibPQFactory
      Parameters:
      sslFactory - ssl factory.
      Returns:
      builder instance
    • sslMode

      public PostgresJdbc sslMode(PostgresJdbc.SslMode sslMode)
      Enables SSL/TLS in a specific mode.

      This option replaces the deprecated options: disableSslHostnameVerification, trustServerCertificate, useSsl

      Parameters:
      sslMode - ssl mode. Default PostgresJdbc.SslMode.PREFER
      Returns:
      builder instance
    • sslcert

      public PostgresJdbc sslcert(String path)
      Provide the full path for the certificate file. Defaults to /defaultdir/postgresql.crt, where defaultdir is ${user.home}/.postgresql/ in *nix systems and %appdata%/postgresql/ on windows.

      It can be a PEM encoded X509v3 certificate

      Note: This parameter is ignored when using PKCS-12 keys, since in that case the certificate is also retrieved from the same keyfile.

      Parameters:
      path - vert path
      Returns:
      builder instance
    • sslkey

      public PostgresJdbc sslkey(String path)
      Provide the full path for the key file. Defaults to /defaultdir/postgresql.pk8.

      Note: The key file must be in PKCS-12 or in PKCS-8 DER format. A PEM key can be converted to DER format using the openssl command:

      Parameters:
      path - path
      Returns:
      builder instance
    • sslrootcert

      public PostgresJdbc sslrootcert(String sslrootcert)
      File name of the SSL root certificate. Defaults to defaultdir/root.crt

      It can be a PEM encoded X509v3 certificate

      Parameters:
      sslrootcert - sslrootcert
      Returns:
      builder instance
    • sslhostnameverifier

      public PostgresJdbc sslhostnameverifier(String sslhostnameverifier)
      Class name of hostname verifier. Defaults to using org.postgresql.ssl.PGjdbcHostnameVerifier
      Parameters:
      sslhostnameverifier - sslhostnameverifier
      Returns:
      builder instance
    • sslpasswordcallback

      public PostgresJdbc sslpasswordcallback(String sslpasswordcallback)
      Class name of the SSL password provider. Defaults to org.postgresql.ssl.jdbc4.LibPQFactory.ConsoleCallbackHandler
      Parameters:
      sslpasswordcallback - sslpasswordcallback
      Returns:
      builder instance
    • sslpassword

      public PostgresJdbc sslpassword(int sslpassword)
      If provided will be used by ConsoleCallbackHandler
      Parameters:
      sslpassword - sslpassword
      Returns:
      builder instance
    • allowMultiQueries

      public PostgresJdbc allowMultiQueries(boolean state)
      Allow multi-queries like insert into ab (i) values (1); insert into ab (i) values
      Parameters:
      state - state. Default: false
      Returns:
      builder instance
    • allowMultiQueries

      public PostgresJdbc allowMultiQueries()
      Allow multi-queries like insert into ab (i) values (1); insert into ab (i) values
      Returns:
      builder instance
    • dumpQueriesOnException

      public PostgresJdbc dumpQueriesOnException(boolean state)
      If set to 'true', an exception is thrown during query execution containing a query string.
      Parameters:
      state - state. Default: false
      Returns:
      builder instance
    • addParameter

      public <V> PostgresJdbc addParameter(String key, V value)
      Add a new parameter to the url
      Overrides:
      addParameter in class JdbcConfig<PostgresJdbc>
      Type Parameters:
      V - value type
      Parameters:
      key - key
      value - value
      Returns:
      builder instance
      See Also:
    • defaultDriverClass

      protected String defaultDriverClass()
      Description copied from class: JdbcConfig
      Returns the full path of the driver class
      Specified by:
      defaultDriverClass in class JdbcConfig<PostgresJdbc>
      Returns:
      driver class