Skip to content

Commit

Permalink
chore: Document how to use unix domain sockets. (#1607)
Browse files Browse the repository at this point in the history
* chore: Document how to use unix domain sockets. Thanks @aleksabl

* fix formatting
  • Loading branch information
davecramer committed Nov 14, 2019
1 parent cd0b555 commit e64b0a2
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions docs/documentation/head/connect.md
Original file line number Diff line number Diff line change
Expand Up @@ -473,6 +473,32 @@ Connection conn = DriverManager.getConnection(url);
`assumeMinServerVersion` with parameter >= 9.4 (backend >= 9.4)</p>


<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

Expand Down

0 comments on commit e64b0a2

Please sign in to comment.