OctaviusProperties

Holds all configuration properties for establishing a connection to a PostgreSQL database using the Octavius driver.

It provides a strongly-typed representation of common connection properties (e.g., host, port, user, password, ssl settings) and stores any unrecognised properties in a map. This class also provides utility methods for parsing properties from a JDBC URL and converting the properties back into a valid JDBC URL.

Constructors

Link copied to clipboard
constructor()

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard

Everything the driver does not recognise, sent to the server as startup parameters. This is what carries search_path, statement_timeout and the rest of PostgreSQL's own settings; the one with a property of its own is applicationName.

Link copied to clipboard

The name this connection reports to the server, where it shows up in pg_stat_activity and in any log line written with %a. Left unset, the driver names itself - Octavius Driver - so a connection is never one of a row of blanks.

Link copied to clipboard

Seconds allowed for a cancel request, covering both its connect and its reads.

Link copied to clipboard

How hard to insist that authentication be bound to the TLS channel. Defaults to ChannelBinding.PREFER: bind when the connection is encrypted and the server offers it.

Link copied to clipboard

The database to connect to. Defaults to postgres.

Link copied to clipboard

Starting size, in bytes, of the per-connection parameter buffer. Defaults to 1024.

Link copied to clipboard

Seconds to wait for the socket connect and login. Falls back to DriverManager.getLoginTimeout(), or 10 seconds when that is 0.

Link copied to clipboard

Whether a traced statement carries the values bound to it, rather than only how many there were. Defaults to false.

Link copied to clipboard

Largest row, in bytes, kept in the reusable row buffer. Defaults to 65536.

Link copied to clipboard

Cap, in bytes, for the per-connection parameter buffer; it shrinks back to initialParameterWriterCapacity after a query that exceeded it. Defaults to 65536.

Link copied to clipboard

Fully-qualified class name of a NoticeHandler for server notices. A Kotlin object is reused as a singleton across connections; a class is instantiated per connection through its no-arg constructor.

Link copied to clipboard

Capacity of the LISTEN/NOTIFY buffer. Defaults to 256.

Link copied to clipboard

The password to authenticate with.

Link copied to clipboard

Port the server listens on. Defaults to 5432.

Link copied to clipboard

Hostname or IP address of the server. Defaults to localhost.

Link copied to clipboard

Seconds to wait on a socket read before failing. Defaults to 0, which waits forever.

Link copied to clipboard
var ssl: Boolean?

Shorthand raising the default SSL mode to SslMode.REQUIRE. Ignored when sslmode is set.

Link copied to clipboard

Path to the client certificate, for certificate authentication. Takes effect only together with sslkey; with either missing, no client certificate is presented.

Link copied to clipboard

Path to the client private key that goes with sslcert. PKCS#8 in PEM form, encrypted or not - an encrypted one is opened with sslpassword; its algorithm is read off sslcert, so RSA and EC alike work without saying which.

Link copied to clipboard

How much protection the connection demands. Defaults to SslMode.PREFER.

Link copied to clipboard

Decrypts sslkey where that key is encrypted - a PEM file opening on BEGIN ENCRYPTED PRIVATE KEY. An unencrypted key ignores it; an encrypted one without it is refused, naming this property.

Link copied to clipboard

Path to the CA certificate the server's chain is verified against, for verify-ca and above. Optional: left unset, the JVM's default trust store is used.

Link copied to clipboard
var user: String?

The user to authenticate as.

Functions

Link copied to clipboard

Returns a complete, independent duplicate of this configuration, password included.

Link copied to clipboard

Copies every set property of other over this one.

Link copied to clipboard
fun setProperty(key: String, value: String)

Sets one property by name, using the same names a JDBC URL would.

Link copied to clipboard
fun toUrl(): String

Renders these properties as a JDBC URL.