Package de.chojo.sqlutil.jdbc
Class PostgresJdbc
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<V> PostgresJdbcaddParameter(String key, V value) Add a new parameter to the urlAllow multi-queries likeinsert into ab (i) values (1); insert into ab (i) valuesallowMultiQueries(boolean state) Allow multi-queries likeinsert into ab (i) values (1); insert into ab (i) valuesconnectTimeout(int millis) The connect timeout value, in milliseconds, or zero for no timeout.protected StringReturns the full path of the driver classdriver()Returns the driver name of the jdbc urldumpQueriesOnException(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(PostgresJdbc.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.Methods inherited from class de.chojo.sqlutil.jdbc.RemoteJdbcConfig
baseUrl, database, host, ipv4, ipv6, localhost, login, password, port, port, userMethods inherited from class de.chojo.sqlutil.jdbc.JdbcConfig
driverClass, jdbcUrl, parameter, self, setDriverClass, setDriverClass, setDriverClass
-
Constructor Details
-
PostgresJdbc
public PostgresJdbc()
-
-
Method Details
-
driver
Description copied from class:JdbcConfigReturns the driver name of the jdbc url- Specified by:
driverin classJdbcConfig<PostgresJdbc>- Returns:
- driver
-
connectTimeout
The connect 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. DefaultPostgresJdbc.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
Add a new parameter to the url- Overrides:
addParameterin classJdbcConfig<PostgresJdbc>- Type Parameters:
V- value type- Parameters:
key- keyvalue- value- Returns:
- builder instance
- See Also:
-
defaultDriverClass
Description copied from class:JdbcConfigReturns the full path of the driver class- Specified by:
defaultDriverClassin classJdbcConfig<PostgresJdbc>- Returns:
- driver class
-