java.lang.Object
de.chojo.sadu.core.jdbc.JdbcConfig<T>
de.chojo.sadu.core.jdbc.RemoteJdbcConfig<PostgreSqlJdbc>
de.chojo.sadu.postgresql.jdbc.PostgreSqlJdbc
A builder to create a PostgreSQL jdbc url.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enum
Represents different SSL modes.Nested classes/interfaces inherited from class de.chojo.sadu.core.jdbc.RemoteJdbcConfig
de.chojo.sadu.core.jdbc.RemoteJdbcConfig.Credentials
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<V> PostgreSqlJdbc
addParameter
(String key, V value) Allow multi-queries likeinsert into ab (i) values (1); insert into ab (i) values
allowMultiQueries
(boolean state) Allow multi-queries likeinsert into ab (i) values (1); insert into ab (i) values
applicationName
(String applicationName) Specifies the name of the application that is using the connection.connectTimeout
(int millis) The connection timeout value, in milliseconds, or zero for no timeout.currentSchema
(String schema) Specify the schema or several schema to be set in the search-path.currentSchema
(String... schemas) Specify the schema or several schema to be set in the search-path.protected String
driver()
dumpQueriesOnException
(boolean state) If set to 'true', an exception is thrown during query execution containing a query string.ssl
(boolean ssl) Connect using SSL.Provide the full path for the certificate file.sslFactory
(String sslFactory) The provided value is a class name to use as the SSLSocketFactory when establishing a SSL connection.sslhostnameverifier
(String sslhostnameverifier) Class name of hostname verifier.Provide the full path for the key file.sslMode
(PostgreSqlJdbc.SslMode sslMode) Enables SSL/TLS in a specific mode.sslpassword
(int sslpassword) If provided will be used by ConsoleCallbackHandlersslpasswordcallback
(String sslpasswordcallback) Class name of the SSL password provider.sslrootcert
(String sslrootcert) File name of the SSL root certificate.withConfig
(de.chojo.sadu.core.configuration.DatabaseConfig config) Methods inherited from class de.chojo.sadu.core.jdbc.RemoteJdbcConfig
baseUrl, database, host, ipv4, ipv6, localhost, login, password, port, port, user, userCredentials
Methods inherited from class de.chojo.sadu.core.jdbc.JdbcConfig
driverClass, driverClass, driverClass, jdbcUrl, parameter, parameterRaw, removeParameter, self
-
Constructor Details
-
PostgreSqlJdbc
public PostgreSqlJdbc()
-
-
Method Details
-
driver
- Specified by:
driver
in classde.chojo.sadu.core.jdbc.JdbcConfig<PostgreSqlJdbc>
-
withConfig
- Overrides:
withConfig
in classde.chojo.sadu.core.jdbc.RemoteJdbcConfig<PostgreSqlJdbc>
-
connectTimeout
The connection timeout value, in milliseconds, or zero for no timeout. Default: 30 000.- Parameters:
millis
- milliseconds- Returns:
- builder instance
-
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
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
Enables SSL/TLS in a specific mode.This option replaces the deprecated options: disableSslHostnameVerification, trustServerCertificate, useSsl
- Parameters:
sslMode
- ssl mode. DefaultPostgreSqlJdbc.SslMode.PREFER
- Returns:
- builder instance
-
sslcert
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
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
File name of the SSL root certificate. Defaults to defaultdir/root.crtIt can be a PEM encoded X509v3 certificate
- Parameters:
sslrootcert
- sslrootcert- Returns:
- builder instance
-
sslhostnameverifier
Class name of hostname verifier. Defaults to using org.postgresql.ssl.PGjdbcHostnameVerifier- Parameters:
sslhostnameverifier
- sslhostnameverifier- Returns:
- builder instance
-
sslpasswordcallback
Class name of the SSL password provider. Defaults toorg.postgresql.ssl.jdbc4.LibPQFactory.ConsoleCallbackHandler
- Parameters:
sslpasswordcallback
- sslpasswordcallback- Returns:
- builder instance
-
sslpassword
If provided will be used by ConsoleCallbackHandler- Parameters:
sslpassword
- sslpassword- Returns:
- builder instance
-
allowMultiQueries
Allow multi-queries likeinsert into ab (i) values (1); insert into ab (i) values
- Parameters:
state
- state. Default: false- Returns:
- builder instance
-
allowMultiQueries
Allow multi-queries likeinsert into ab (i) values (1); insert into ab (i) values
- Returns:
- builder instance
-
dumpQueriesOnException
If set to 'true', an exception is thrown during query execution containing a query string.- Parameters:
state
- state. Default: false- Returns:
- builder instance
-
addParameter
- Overrides:
addParameter
in classde.chojo.sadu.core.jdbc.JdbcConfig<PostgreSqlJdbc>
- See Also:
-
currentSchema
Specify the schema or several schema to be set in the search-path. This schema will be used to resolve unqualified object names used in statements over this connection.- Parameters:
schemas
- default schemas- Returns:
- builder instance
-
currentSchema
Specify the schema or several schema to be set in the search-path. This schema will be used to resolve unqualified object names used in statements over this connection.- Parameters:
schema
- the default schema- Returns:
- builder instance
-
applicationName
Specifies the name of the application that is using the connection. This allows a database administrator to see what applications are connected to the server and what resources they are using through views like pgstatactivity.- Parameters:
applicationName
- application name- Returns:
- builder instance
-
defaultDriverClass
- Specified by:
defaultDriverClass
in classde.chojo.sadu.core.jdbc.JdbcConfig<PostgreSqlJdbc>
-