Skip to content

Commits on Source 3

......@@ -9,7 +9,7 @@
1. [ ] Does your submission pass tests?
2. [ ] Does mvn checkstyle:check pass ?
3. [ ] Have you added your new test classes to an existing test suite?
3. [ ] Have you added your new test classes to an existing test suite in alphabetical order?
### Changes to Existing Features:
......
......@@ -4,11 +4,31 @@ Notable changes since version 42.0.0, read the complete [History of Changes](htt
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
## [Unreleased]
## [42.2.9] (2019-12-06)
### Changed
### Added
- read only transactions [PR 1252](https://github.com/pgjdbc/pgjdbc/pull/1252)
- pkcs12 key functionality [PR 1599](https://github.com/pgjdbc/pgjdbc/pull/1599)
- new "escapeSyntaxCallMode" connection property [PR 1560](https://github.com/pgjdbc/pgjdbc/pull/1560)
- connection property to limit server error detail in exception exceptions [PR 1579](https://github.com/pgjdbc/pgjdbc/pull/1579)
- cancelQuery() to PGConnection public interface [PR 1157](https://github.com/pgjdbc/pgjdbc/pull/1157)
- support for large update counts (JDBC 4.2) [PR 935](https://github.com/pgjdbc/pgjdbc/pull/935)
- Add Binary Support for Oid.NUMERIC and Oid.NUMERIC_ARRAY [PR 1636](https://github.com/pgjdbc/pgjdbc/pull/1636)
### Fixed
- issue 716 getTypeInfo() may not return data in the order specified in Oracle documentation [PR 1506](https://github.com/pgjdbc/pgjdbc/pull/1506)
- PgSQLXML setCharacterStream() results in null value [PR 1608](https://github.com/pgjdbc/pgjdbc/pull/1608)
- get correct column length for simple domains [PR 1605](https://github.com/pgjdbc/pgjdbc/pull/1605)
- NPE as a result of calling executeQuery twice on a statement fixes issue [#684](https://github.com/pgjdbc/pgjdbc/issues/684) [PR 1610] (https://github.com/pgjdbc/pgjdbc/pull/1610)
- handle numeric domain types [PR 1611](https://github.com/pgjdbc/pgjdbc/pull/1611)
- pginterval to take iso8601 strings [PR 1612](https://github.com/pgjdbc/pgjdbc/pull/1612)
- remove currentTimeMillis from code, tests are OK [PR 1617](https://github.com/pgjdbc/pgjdbc/pull/1617)
- NPE when calling setNull on a PreparedStatement with no parameters [PR 1620](https://github.com/pgjdbc/pgjdbc/pull/1620)
- allow OUT parameter registration when using CallableStatement native CALL [PR 1561](https://github.com/pgjdbc/pgjdbc/pull/1561)
- add release save point into execute with batch [PR 1583](https://github.com/pgjdbc/pgjdbc/pull/1583)
- Prevent use of extended query protocol for BEGIN before COPY [PR 1639](https://github.com/pgjdbc/pgjdbc/pull/1639)
## [42.2.8] (2019-09-13)
### Changed
......@@ -246,4 +266,5 @@ thrown to caller to be dealt with so no need to log at this verbosity by pgjdbc
[42.2.6]: https://github.com/pgjdbc/pgjdbc/compare/REL42.2.5...REL42.2.6
[42.2.7]: https://github.com/pgjdbc/pgjdbc/compare/REL42.2.6...REL42.2.7
[42.2.8]: https://github.com/pgjdbc/pgjdbc/compare/REL42.2.7...REL42.2.8
[Unreleased]: https://github.com/pgjdbc/pgjdbc/compare/REL42.2.8...HEAD
[42.2.9]: https://github.com/pgjdbc/pgjdbc/compare/REL42.2.8...REL42.2.9
[Unreleased]: https://github.com/pgjdbc/pgjdbc/compare/REL42.2.9...HEAD
......@@ -148,9 +148,10 @@ In addition to the standard connection parameters the driver supports a number o
| socketFactory | String | null | Specify a socket factory for socket creation |
| socketFactoryArg (deprecated) | String | null | Argument forwarded to constructor of SocketFactory class. |
| autosave | String | never | Specifies what the driver should do if a query fails, possible values: always, never, conservative |
| cleanupSavePoints | Boolean | false | In Autosave mode the driver sets a SAVEPOINT for every query. It is possible to exhaust the server shared buffers. Setting this to true will release each SAVEPOINT at the cost of an additional round trip. |
| cleanupSavepoints | Boolean | false | In Autosave mode the driver sets a SAVEPOINT for every query. It is possible to exhaust the server shared buffers. Setting this to true will release each SAVEPOINT at the cost of an additional round trip. |
| preferQueryMode | String | extended | Specifies which mode is used to execute queries to database, possible values: extended, extendedForPrepared, extendedCacheEverything, simple |
| reWriteBatchedInserts | Boolean | false | Enable optimization to rewrite and collapse compatible INSERT statements that are batched. |
| escapeSyntaxCallMode | String | select | Specifies how JDBC escape call syntax is transformed into underlying SQL (CALL/SELECT), for invoking procedures or functions (requires server version >= 11), possible values: select, callIfNoReturn, call |
## Contributing
For information on how to contribute to the project see the [Contributing Guidelines](CONTRIBUTING.md)
......
......@@ -48,3 +48,9 @@ openssl req -x509 -newkey rsa:1024 -nodes -days 3650 -keyout server.key -out ser
cp server.crt ../goodroot.crt
#Common name is localhost, no password
#PKCS12
Create the goodclient.p12 file with
openssl pkcs12 -export -in goodclient.crt -inkey goodclient.key -out goodclient.p12 -name local -CAfile client_ca.crt -caname local
libpgjava (42.2.8-2) UNRELEASED; urgency=medium
libpgjava (42.2.9-1) unstable; urgency=medium
*
* New upstream version.
-- Christoph Berg <myon@debian.org> Tue, 10 Dec 2019 11:13:16 +0100
-- Christoph Berg <myon@debian.org> Wed, 18 Dec 2019 11:47:04 +0100
libpgjava (42.2.8-1) unstable; urgency=medium
......
---
title: PostgreSQL JDBC Driver 42.2.9 Released
date: 2019-12-06 17:52:49 +0000
categories:
- new_release
version: 42.2.9
---
**Notable changes**
### Changed
### Added
- read only transactions [PR 1252](https://github.com/pgjdbc/pgjdbc/pull/1252)
- pkcs12 key functionality [PR 1599](https://github.com/pgjdbc/pgjdbc/pull/1599)
- new "escapeSyntaxCallMode" connection property [PR 1560](https://github.com/pgjdbc/pgjdbc/pull/1560)
- connection property to limit server error detail in exception exceptions [PR 1579](https://github.com/pgjdbc/pgjdbc/pull/1579)
- cancelQuery() to PGConnection public interface [PR 1157](https://github.com/pgjdbc/pgjdbc/pull/1157)
- support for large update counts (JDBC 4.2) [PR 935](https://github.com/pgjdbc/pgjdbc/pull/935)
- Add Binary Support for Oid.NUMERIC and Oid.NUMERIC_ARRAY [PR 1636](https://github.com/pgjdbc/pgjdbc/pull/1636)
### Fixed
- issue 716 getTypeInfo() may not return data in the order specified in Oracle documentation [PR 1506](https://github.com/pgjdbc/pgjdbc/pull/1506)
- PgSQLXML setCharacterStream() results in null value [PR 1608](https://github.com/pgjdbc/pgjdbc/pull/1608)
- get correct column length for simple domains [PR 1605](https://github.com/pgjdbc/pgjdbc/pull/1605)
- NPE as a result of calling executeQuery twice on a statement fixes issue [#684](https://github.com/pgjdbc/pgjdbc/issues/684) [PR 1610] (https://github.com/pgjdbc/pgjdbc/pull/1610)
- handle numeric domain types [PR 1611](https://github.com/pgjdbc/pgjdbc/pull/1611)
- pginterval to take iso8601 strings [PR 1612](https://github.com/pgjdbc/pgjdbc/pull/1612)
- remove currentTimeMillis from code, tests are OK [PR 1617](https://github.com/pgjdbc/pgjdbc/pull/1617)
- NPE when calling setNull on a PreparedStatement with no parameters [PR 1620](https://github.com/pgjdbc/pgjdbc/pull/1620)
- allow OUT parameter registration when using CallableStatement native CALL [PR 1561](https://github.com/pgjdbc/pgjdbc/pull/1561)
- add release save point into execute with batch [PR 1583](https://github.com/pgjdbc/pgjdbc/pull/1583)
- Prevent use of extended query protocol for BEGIN before COPY [PR 1639](https://github.com/pgjdbc/pgjdbc/pull/1639)
<!--more-->
**Commits by author**
Brett Okken (1):
* feat: read only transactions [PR 1252](https://github.com/pgjdbc/pgjdbc/pull/1252) [05079793](https://github.com/pgjdbc/pgjdbc/commit/050797934a8a9c0ce2dff068eba14931988370ca)
Craig Ringer (1):
* Prevent use of extended query protocol for BEGIN before COPY [PR 1639](https://github.com/pgjdbc/pgjdbc/pull/1639) [b3711537](https://github.com/pgjdbc/pgjdbc/commit/b37115373935732b1ab5e59b56837ac49942718a)
Dave Cramer (20):
* Add simple test to make sure we can load a key [PR 1588](https://github.com/pgjdbc/pgjdbc/pull/1588) [7c591262](https://github.com/pgjdbc/pgjdbc/commit/7c591262792b8ff8f6139f67a98c16d41f2adf4f)
* Update prepare.md [PR 1601](https://github.com/pgjdbc/pgjdbc/pull/1601) [5e48eaa4](https://github.com/pgjdbc/pgjdbc/commit/5e48eaa4c9f6fc07904944bd98ad45fbb4aefd10)
* fix: issue 716 getTypeInfo() may not return data in the order specified in Oracle documentation [PR 1506](https://github.com/pgjdbc/pgjdbc/pull/1506) [9b8a3ffd](https://github.com/pgjdbc/pgjdbc/commit/9b8a3ffd8a952a55be28d14cb80a23fdbb955133)
* chore: Document how to use unix domain sockets. [PR 1607](https://github.com/pgjdbc/pgjdbc/pull/1607) [e64b0a2d](https://github.com/pgjdbc/pgjdbc/commit/e64b0a2df8dd5e94a24fbb2e2e197f6d7fed7d9a)
* fix: PgSQLXML setCharacterStream() results in null value [PR 1608](https://github.com/pgjdbc/pgjdbc/pull/1608) [1e370263](https://github.com/pgjdbc/pgjdbc/commit/1e370263d2f59da04fd1f8fe55bb83afdc0a51dc)
* add test for table name with values in it [PR 1609](https://github.com/pgjdbc/pgjdbc/pull/1609) [47f756fa](https://github.com/pgjdbc/pgjdbc/commit/47f756fa926f7c78a7f55f030aadf7be82195e52)
* fix: get correct column length for simple domains [PR 1605](https://github.com/pgjdbc/pgjdbc/pull/1605) [8abf3161](https://github.com/pgjdbc/pgjdbc/commit/8abf3161d17fef3783c0c597e91c1fe455efc2e8)
* fix: NPE as a result of calling executeQuery twice on a statement fixes issue [PR 684](https://github.com/pgjdbc/pgjdbc/pull/684) (#1610) [00fa4485](https://github.com/pgjdbc/pgjdbc/commit/00fa448587532cc219977679bb8c573a1dcae11c)
* fix:handle numeric domain types [PR 1611](https://github.com/pgjdbc/pgjdbc/pull/1611) [7f1752a1](https://github.com/pgjdbc/pgjdbc/commit/7f1752a1f2853c88333b3ac75c2dc0212272b254)
* add checks for null results [PR 1616](https://github.com/pgjdbc/pgjdbc/pull/1616) [69320c7a](https://github.com/pgjdbc/pgjdbc/commit/69320c7a7dc065f44db5ddeec8143c606298b382)
* fix: pginterval to take iso8601 strings [PR 1612](https://github.com/pgjdbc/pgjdbc/pull/1612) [7b454355](https://github.com/pgjdbc/pgjdbc/commit/7b454355939aebd995b1b79598a1e945c168eb68)
* fix: remove currentTimeMillis from code, tests are OK [PR 1617](https://github.com/pgjdbc/pgjdbc/pull/1617) [ff4a66d2](https://github.com/pgjdbc/pgjdbc/commit/ff4a66d29d863cb4a6d2aecee2faec424f8d51d7)
* fix: NPE when calling setNull on a PreparedStatement with no parameters [PR 1620](https://github.com/pgjdbc/pgjdbc/pull/1620) [6899a43d](https://github.com/pgjdbc/pgjdbc/commit/6899a43dff735ab14a02bedea853266de768da50)
* doc: correct documentation about last applied message fixes [PR 760](https://github.com/pgjdbc/pgjdbc/pull/760) (#1621) [fdf898c7](https://github.com/pgjdbc/pgjdbc/commit/fdf898c781c00839210936d668d2341ca6c08406)
* docs: fix documentation about oids [PR 1624](https://github.com/pgjdbc/pgjdbc/pull/1624) [4edca517](https://github.com/pgjdbc/pgjdbc/commit/4edca517bfdc0bffb2141369394d611803b43523)
* fix: javadoc requires throws annotation [PR 1625](https://github.com/pgjdbc/pgjdbc/pull/1625) [4258e0d0](https://github.com/pgjdbc/pgjdbc/commit/4258e0d0cfdc50aaec3d31301fd793e221740bda)
* fix: Add pkcs12 key functionality [PR 1599](https://github.com/pgjdbc/pgjdbc/pull/1599) [82c2008f](https://github.com/pgjdbc/pgjdbc/commit/82c2008f83dd687e80b1e3acdeeb618dccc2fb5c)
* Actually test cleanSavePoints [PR 1509](https://github.com/pgjdbc/pgjdbc/pull/1509) [97d32caa](https://github.com/pgjdbc/pgjdbc/commit/97d32caad1f72c11d3e89ffaf16a17a22c6b9790)
* fix: DatabaseMetaData.getFunctions should not limit the search to the search_path if the schema is provided [PR 1633](https://github.com/pgjdbc/pgjdbc/pull/1633) [8106d3df](https://github.com/pgjdbc/pgjdbc/commit/8106d3df5c3f6ea3cbc3e621977df5542b182b56)
* feat: WIP Filter DatabaseMetaData using privileges for the user [PR 1630](https://github.com/pgjdbc/pgjdbc/pull/1630) [ec76bace](https://github.com/pgjdbc/pgjdbc/commit/ec76bace1d4e3c02a7bf235f726a6c6d7feb6ee3)
Dongming (1):
* Adjust the default port to 5432. [PR 1619](https://github.com/pgjdbc/pgjdbc/pull/1619) [9a193de7](https://github.com/pgjdbc/pgjdbc/commit/9a193de71d3e834a231f8f5027fb887e00e903d2)
GregN (2):
* feat: add new "escapeSyntaxCallMode" connection property [PR 1560](https://github.com/pgjdbc/pgjdbc/pull/1560) [d7559138](https://github.com/pgjdbc/pgjdbc/commit/d75591385538cd704a066c4ed026f767ce3784ab)
* fix: allow OUT parameter registration when using CallableStatement native CALL [PR 1561](https://github.com/pgjdbc/pgjdbc/pull/1561) [ed74670f](https://github.com/pgjdbc/pgjdbc/commit/ed74670fae932935a156eccfb4b1ff16758f5693)
Igor Volkov (1):
* Fix exception on PGCopyOutputStream.close() after endCopy() [PR 1574](https://github.com/pgjdbc/pgjdbc/pull/1574) (#1575) [539a0925](https://github.com/pgjdbc/pgjdbc/commit/539a09258f6009581785474fe5f15a46992ade6f)
IvyDev0 (1):
* fix: null pointer exception from PgResultSetMetaData when there's no column metadata [PR 1615](https://github.com/pgjdbc/pgjdbc/pull/1615) [08bd46bf](https://github.com/pgjdbc/pgjdbc/commit/08bd46bfccc9c9481650e4ee09c943ec78d77895)
Jorge Solorzano (1):
* feat: support for large update counts (JDBC 4.2) [PR 935](https://github.com/pgjdbc/pgjdbc/pull/935) [0888e935](https://github.com/pgjdbc/pgjdbc/commit/0888e9355ca065ac2eae4e3085442ffd54f6dec6)
Knut Wannheden (1):
* Fix Markdown formatting issue [PR 1576](https://github.com/pgjdbc/pgjdbc/pull/1576) [69edc0b8](https://github.com/pgjdbc/pgjdbc/commit/69edc0b8f0985465af0ba0ee258f6b2564240232)
Mahmoud Bahaa (2):
* Add Binary Support for Oid.NUMERIC and Oid.NUMERIC_ARRAY [PR 1636](https://github.com/pgjdbc/pgjdbc/pull/1636) [c85b149d](https://github.com/pgjdbc/pgjdbc/commit/c85b149d68c30ede0559d4bff6bc616ec03b2517)
* Only allow binary transfer for those Oids that the pgjdbc currently supports [PR 1637](https://github.com/pgjdbc/pgjdbc/pull/1637) [ad83cb33](https://github.com/pgjdbc/pgjdbc/commit/ad83cb332058f0a891b89f47ceefb538cbf031db)
Michail Nikolaev (1):
* fix: do ssl handshake after socket timeout and buffer size settings [PR 1584](https://github.com/pgjdbc/pgjdbc/pull/1584) [e39a0be0](https://github.com/pgjdbc/pgjdbc/commit/e39a0be0739d016f524e7aef567f95e6ea59fd54)
Pavel Raiskup (1):
* rpm: drop BR on properties-maven-plugin [91186c08](https://github.com/pgjdbc/pgjdbc/commit/91186c08968f15b11b7338f1a565124abedcbfae)
Sehrope Sarkuni (5):
* Clean up some tests and fix IsValidTest race condition [PR 1581](https://github.com/pgjdbc/pgjdbc/pull/1581) [ad734574](https://github.com/pgjdbc/pgjdbc/commit/ad734574726eb0decf5178071c87a1b513e484f2)
* Fix test suite order [PR 1593](https://github.com/pgjdbc/pgjdbc/pull/1593) [003ea835](https://github.com/pgjdbc/pgjdbc/commit/003ea8352dab2b49b4734cdf7338befb4d9b9ed4)
* fix: Update error message for COPY commands executed using JDBC API [PR 1300](https://github.com/pgjdbc/pgjdbc/pull/1300) [c99ed121](https://github.com/pgjdbc/pgjdbc/commit/c99ed1213410872915930bea4471df6b1bdc503e)
* Add connection property to limit server error detail in exception exceptions [PR 1579](https://github.com/pgjdbc/pgjdbc/pull/1579) [cd0b555c](https://github.com/pgjdbc/pgjdbc/commit/cd0b555c8045fc71e6f4d0fb0f24a2deb726301e)
* feat: Add cancelQuery() to PGConnection public interface [PR 1157](https://github.com/pgjdbc/pgjdbc/pull/1157) [f0af538f](https://github.com/pgjdbc/pgjdbc/commit/f0af538f59924fd9d692627102c94517e5f6008e)
Tom Eicher (1):
* fix: DataSources broken by connection failover urls [PR 1039](https://github.com/pgjdbc/pgjdbc/pull/1039) (#1457) [bd9485ef](https://github.com/pgjdbc/pgjdbc/commit/bd9485ef7b889ec7397b1e39f77f5d396f06ed05)
Torsten Brodbeck (1):
* fix camel case writing of 'cleanupSavepoints' [PR 1587](https://github.com/pgjdbc/pgjdbc/pull/1587) [0fd45353](https://github.com/pgjdbc/pgjdbc/commit/0fd45353e504ed7821af69c8053814918212b8d7)
Yuriy Yudin (1):
* fix: add release save point into execute with batch [PR 1583](https://github.com/pgjdbc/pgjdbc/pull/1583) [504bb316](https://github.com/pgjdbc/pgjdbc/commit/504bb316b91fdbc6506a2e9870453fb75fbbb083)
rnveach (1):
* upgrade maven-checkstyle-plugin to 3.1.0 [PR 1573](https://github.com/pgjdbc/pgjdbc/pull/1573) [831115c1](https://github.com/pgjdbc/pgjdbc/commit/831115c1e8ede27d6a0434022b11edab7082721a)
Árpád Magosányi (2):
* fix documentation on generating the pk8 key. closes: [PR 1585](https://github.com/pgjdbc/pgjdbc/pull/1585) (#1586) [635cc865](https://github.com/pgjdbc/pgjdbc/commit/635cc86562aebc223dcc0d163639c5039a6b54c0)
* security notice and clarifications on choosing the right cipher suite for client key [PR 1591](https://github.com/pgjdbc/pgjdbc/pull/1591) [c67b0b0b](https://github.com/pgjdbc/pgjdbc/commit/c67b0b0b667a6b9f1b13ed5359687f3bc20ac61b)
<a name="contributors_{{ page.version }}"></a>
### Contributors to this release
We thank the following people for their contributions to this release.
[Árpád Magosányi](https://github.com/magwas)
[Brett Okken](https://github.com/bokken)
[Craig Ringer](https://github.com/ringerc)
[Dave Cramer](davec@postgresintl.com)
[Dongming](https://github.com/ldming)
[GregN](https://github.com/gregn123)
[Igor Volkov](https://github.com/virtual-machinist)
[IvyDev0](https://github.com/IvyDev0)
[Jorge Solorzano](https://github.com/jorsol)
[Knut Wannheden](https://github.com/knutwannheden)
[Mahmoud Bahaa](https://github.com/mahmoudbahaa)
[Michail Nikolaev](https://github.com/michail-nikolaev)
[Pavel Raiskup](https://github.com/praiskup)
[rnveach](https://github.com/rnveach)
[Sehrope Sarkuni](https://github.com/sehrope)
[Tom Eicher](https://github.com/teicher)
[Torsten Brodbeck](https://github.com/tbrodbeck-adc)
[Yuriy Yudin](https://github.com/junixar)
......@@ -88,17 +88,19 @@ Connection conn = DriverManager.getConnection(url);
* **ssl** = boolean
Connect using SSL. The driver must have been compiled with SSL support.
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*](ssl.html).
Setting up the certificates and keys for ssl connection can be tricky see [The test documentation](https://github.com/pgjdbc/pgjdbc/blob/master/certdir/README.md) for detailed examples.
* **sslfactory** = String
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”](ssl-factory.html).
called [“Custom SSLSocketFactory”](ssl-factory.html). defaults to LibPQFactory
* **sslfactoryarg** (deprecated) = String
......@@ -120,20 +122,30 @@ Connection conn = DriverManager.getConnection(url);
Provide the full path for the certificate file. Defaults to /defaultdir/postgresql.crt
It can be a PEM encoded X509v3 certificate
*Note:* defaultdir is ${user.home}/.postgresql/ in *nix systems and %appdata%/postgresql/ on windows
* **sslkey** = String
Provide the full path for the key file. Defaults to /defaultdir/postgresql.pk8.
*Note:* The key file **must** be in [DER format](https://wiki.openssl.org/index.php/DER). A PEM key can be converted to DER format using the openssl command:
*Note:* The key file **must** be in [PKCS-8](https://en.wikipedia.org/wiki/PKCS_8) [DER format](https://wiki.openssl.org/index.php/DER). A PEM key can be converted to DER format using the openssl command:
`openssl pkcs8 -topk8 -inform PEM -in my.key -outform DER -out my.key.der`
`openssl pkcs8 -topk8 -inform PEM -in my.key -outform DER -out my.key.der -v1 PBE-MD5-DES`
*Note:* The use of -v1 PBE-MD5-DES might be inadequate in environments where high level of security is needed and the key is not protected
by other means (e.g. access control of the OS), or the key file is transmitted in untrusted channels.
We are depending on the cryptography providers provided by the java runtime. The solution documented here is known to work at
the time of writing. If you have stricter security needs, please see https://stackoverflow.com/questions/58488774/configure-tomcat-hibernate-to-have-a-cryptographic-provider-supporting-1-2-840-1
for a discussion of the problem and information on choosing a better cipher suite.
* **sslrootcert** = String
File name of the SSL root certificate. Defaults to defaultdir/root.crt
It can be a PEM encoded X509v3 certificate
* **sslhostnameverifier** = String
Class name of hostname verifier. Defaults to using `org.postgresql.ssl.PGjdbcHostnameVerifier`
......@@ -208,7 +220,7 @@ Connection conn = DriverManager.getConnection(url);
The default is `never`
* **cleanupSavePoints** = boolean
* **cleanupSavepoints** = boolean
Determines if the SAVEPOINT created in autosave mode is released prior to the statement. This is
done to avoid running out of shared buffers on the server in the case where 1000's of queries are
......@@ -460,6 +472,42 @@ Connection conn = DriverManager.getConnection(url);
for logical replication from that database. <p>Parameter should be use together with
`assumeMinServerVersion` with parameter >= 9.4 (backend >= 9.4)</p>
* **escapeSyntaxCallMode** = String
Specifies how the driver transforms JDBC escape call syntax into underlying SQL, for invoking procedures or functions.
In `escapeSyntaxCallMode=select` mode (the default), the driver always uses a SELECT statement (allowing function invocation only).
In `escapeSyntaxCallMode=callIfNoReturn` mode, the driver uses a CALL statement (allowing procedure invocation) if there is no
return parameter specified, otherwise the driver uses a SELECT statement.
In `escapeSyntaxCallMode=call` mode, the driver always uses a CALL statement (allowing procedure invocation only).
The default is `select`
<a name="unix sockets"></a>
## Unix sockets
Aleksander Blomskøld has forked junixsocket and added a [Unix SocketFactory](https://github.com/fiken/junixsocket/blob/master/junixsocket-common/src/main/java/org/newsclub/net/unix/socketfactory/PostgresqlAFUNIXSocketFactory.java) that works with the driver.
His code can be found at [https://github.com/fiken/junixsocket](https://github.com/fiken/junixsocket).
Dependencies for junixsocket are :
```xml
<dependency>
<groupId>no.fiken.oss.junixsocket</groupId>
<artifactId>junixsocket-common</artifactId>
<version>1.0.2</version>
</dependency>
<dependency>
<groupId>no.fiken.oss.junixsocket</groupId>
<artifactId>junixsocket-native-common</artifactId>
<version>1.0.2</version>
</dependency>
```
Simply add
`?socketFactory=org.newsclub.net.unix.socketfactory.PostgresqlAFUNIXSocketFactory&socketFactoryArg=[path-to-the-unix-socket]`
to the connection URL.
For many distros the default path is /var/run/postgresql/.s.PGSQL.5432
<a name="connection-failover"></a>
## Connection Fail-over
......
......@@ -21,5 +21,5 @@ default, and you must set `tcpip_socket = true` in the `postgresql.conf` file.
Once you have made sure the server is correctly listening for TCP/IP connections
the next step is to verify that users are allowed to connect to the server. Client
authentication is setup in `pg_hba.conf`. Refer to the main PostgreSQL™ documentation
for details. The JDBC driver supports the `trust`, `ident`, `password`, `md5`, and
for details. The JDBC driver supports the `trust`, `ident`, `password`, `md5`, `gss` and
`crypt` authentication methods.
......@@ -35,7 +35,7 @@ stored in the server certificate.
The SSL connection will fail if the server certificate cannot be verified. `verify-full` is recommended
in most security-sensitive environments.
The default SSL Socket factory is the LibPQFactory
In the case where the certificate validation is failing you can try `sslcert=` and LibPQFactory will
not send the client certificate. If the server is not configured to authenticate using the certificate
it should connect.
......@@ -45,6 +45,9 @@ The location of the client certificate, client key and root certificate can be o
/defaultdir/postgresql.pk8, and /defaultdir/root.crt respectively where defaultdir is
${user.home}/.postgresql/ in *nix systems and %appdata%/postgresql/ on windows
as of version 42.2.9 PKCS12 is supported. In this archive format the key, cert and root cert are all
in one file which by default is /defaultdir/postgresql.p12
Finer control of the SSL connection can be achieved using the `sslmode` connection parameter.
This parameter is the same as the libpq `sslmode` parameter and the currently SSL implements the
following
......
......@@ -20,10 +20,12 @@ next: ssl-client.html
# Configuring the Server
Configuring the PostgreSQL™ server for SSL is covered in the [main
documentation](http://www.postgresql.org/docs/current/static/ssl-tcp.html),
so it will not be repeated here. Before trying to access your SSL enabled
server from Java, make sure you can get to it via **psql**. You should
see output like the following if you have established a SSL connection.
documentation](https://www.postgresql.org/docs/current/ssl-tcp.html),
so it will not be repeated here. There are also instructions in the source
[certdir](https://github.com/pgjdbc/pgjdbc/tree/master/certdir)
Before trying to access your SSL enabled server from Java, make sure
you can get to it via **psql**. You should see output like the following
if you have established a SSL connection.
```
$ ./bin/psql -h localhost -U postgres
......
......@@ -61,7 +61,6 @@ BuildArch: noarch
BuildRequires: java-devel >= 1.8
BuildRequires: maven-local
BuildRequires: java-comment-preprocessor
BuildRequires: properties-maven-plugin
BuildRequires: maven-enforcer-plugin
BuildRequires: maven-plugin-bundle
BuildRequires: maven-plugin-build-helper
......@@ -108,6 +107,8 @@ find -name "*.jar" -or -name "*.class" | xargs rm -f
%pom_xpath_set pom:relativePath ../pgjdbc-parent-poms/pgjdbc-core-parent pgjdbc
%pom_xpath_remove "pom:plugin[pom:artifactId = 'maven-shade-plugin']" pgjdbc
%pom_remove_plugin :karaf-maven-plugin pgjdbc
%pom_remove_plugin :properties-maven-plugin pgjdbc-parent-poms/pgjdbc-core-parent
%pom_remove_plugin :properties-maven-plugin pgjdbc-parent-poms/pgjdbc-versions
# compat symlink: requested by dtardon (libreoffice), reverts part of
# 0af97ce32de877 commit.
......
......@@ -10,7 +10,7 @@
<artifactId>postgresql</artifactId>
<packaging>bundle</packaging>
<name>PostgreSQL JDBC Driver - JDBC 4.2</name>
<version>42.2.8</version>
<version>42.2.9</version>
<description>Java JDBC 4.2 (JRE 8+) driver for PostgreSQL database</description>
<url>https://github.com/pgjdbc/pgjdbc</url>
......@@ -329,7 +329,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>3.0.0</version>
<version>3.1.0</version>
<dependencies>
<dependency>
<groupId>com.puppycrawl.tools</groupId>
......@@ -359,6 +359,6 @@
</build>
<scm>
<tag>REL42.2.8</tag>
<tag>REL42.2.9</tag>
</scm>
</project>
......@@ -61,7 +61,7 @@ public class Driver implements java.sql.Driver {
private static final Logger LOGGER = Logger.getLogger("org.postgresql.Driver");
private static SharedTimer sharedTimer = new SharedTimer();
private static final String DEFAULT_PORT =
/*$"\""+mvn.project.property.template.default.pg.port+"\";"$*//*-*/"5431";
/*$"\""+mvn.project.property.template.default.pg.port+"\";"$*//*-*/"5432";
static {
try {
......@@ -397,7 +397,7 @@ public class Driver implements java.sql.Driver {
* @throws SQLException if a connection error occurs or the timeout is reached
*/
public Connection getResult(long timeout) throws SQLException {
long expiry = System.currentTimeMillis() + timeout;
long expiry = System.nanoTime() / 1000 + timeout;
synchronized (this) {
while (true) {
if (result != null) {
......@@ -416,7 +416,7 @@ public class Driver implements java.sql.Driver {
}
}
long delay = expiry - System.currentTimeMillis();
long delay = expiry - System.nanoTime() / 1000;
if (delay <= 0) {
abandoned = true;
throw new PSQLException(GT.tr("Connection attempt timed out."),
......
......@@ -184,6 +184,12 @@ public interface PGConnection {
*/
int getBackendPID();
/**
* Sends a query cancellation for this connection.
* @throws SQLException if there are problems cancelling the query
*/
void cancelQuery() throws SQLException;
/**
* Return the given string suitably quoted to be used as an identifier in an SQL statement string.
* Quotes are added only if necessary (i.e., if the string contains non-identifier characters or
......
......@@ -10,6 +10,7 @@ import org.postgresql.util.GT;
import org.postgresql.util.PSQLException;
import org.postgresql.util.PSQLState;
import java.sql.Connection;
import java.sql.DriverPropertyInfo;
import java.util.Properties;
......@@ -172,6 +173,12 @@ public enum PGProperty {
LOG_UNCLOSED_CONNECTIONS("logUnclosedConnections", "false",
"When connections that are not explicitly closed are garbage collected, log the stacktrace from the opening of the connection to trace the leak source"),
/**
* Whether to include full server error detail in exception messages.
*/
LOG_SERVER_ERROR_DETAIL("logServerErrorDetail", "true",
"Include full server error detail in exception messages. If disabled then only the error itself will be included."),
/**
* Enable optimization that disables column name sanitiser.
*/
......@@ -418,6 +425,13 @@ public enum PGProperty {
REWRITE_BATCHED_INSERTS("reWriteBatchedInserts", "false",
"Enable optimization to rewrite and collapse compatible INSERT statements that are batched."),
/**
* Enable mode to filter out the names of database objects for which the current user has no privileges
* granted from appearing in the DatabaseMetaData returned by the driver.
*/
HIDE_UNPRIVILEGED_OBJECTS("hideUnprivilegedObjects", "false",
"Enable hiding of database objects for which the current user has no privileges granted from the DatabaseMetaData"),
/**
* <p>Connection parameter passed in the startup message. This parameter accepts two values; "true"
* and "database". Passing "true" tells the backend to go into walsender mode, wherein a small set
......@@ -437,7 +451,32 @@ public enum PGProperty {
+ "to the database specified in the dbname parameter, "
+ "which will allow the connection to be used for logical replication "
+ "from that database. "
+ "(backend >= 9.4)");
+ "(backend >= 9.4)"),
/**
* Specifies how the driver transforms JDBC escape call syntax into underlying SQL, for invoking procedures or functions. (backend &gt;= 11)
* In {@code escapeSyntaxCallMode=select} mode (the default), the driver always uses a SELECT statement (allowing function invocation only).
* In {@code escapeSyntaxCallMode=callIfNoReturn} mode, the driver uses a CALL statement (allowing procedure invocation) if there is no return parameter specified, otherwise the driver uses a SELECT statement.
* In {@code escapeSyntaxCallMode=call} mode, the driver always uses a CALL statement (allowing procedure invocation only).
*/
ESCAPE_SYNTAX_CALL_MODE("escapeSyntaxCallMode", "select",
"Specifies how the driver transforms JDBC escape call syntax into underlying SQL, for invoking procedures or functions. (backend >= 11)"
+ "In escapeSyntaxCallMode=select mode (the default), the driver always uses a SELECT statement (allowing function invocation only)."
+ "In escapeSyntaxCallMode=callIfNoReturn mode, the driver uses a CALL statement (allowing procedure invocation) if there is no return parameter specified, otherwise the driver uses a SELECT statement."
+ "In escapeSyntaxCallMode=call mode, the driver always uses a CALL statement (allowing procedure invocation only).",
false, "select", "callIfNoReturn", "call"),
/**
* Connection parameter to control behavior when
* {@link Connection#setReadOnly(boolean)} is set to {@code true}.
*/
READ_ONLY_MODE("readOnlyMode", "transaction",
"Controls the behavior when a connection is set to be read only, one of 'ignore', 'transaction', or 'always' "
+ "When 'ignore', setting readOnly has no effect. "
+ "When 'transaction' setting readOnly to 'true' will cause transactions to BEGIN READ ONLY if autocommit is 'false'. "
+ "When 'always' setting readOnly to 'true' will set the session to READ ONLY if autoCommit is 'true' "
+ "and the transaction to BEGIN READ ONLY if autocommit is 'false'.",
false, "ignore", "transaction", "always");
private final String name;
private final String defaultValue;
......