JDBC: Support for Custom Sockets

Details

Detail name Value
Changelog Number 11429
Type New Feature
Status Resolved
Fix Versions Exasol 7.1.0
Resolution Date 2021-08-03

New Feature

The JDBC driver now supports the CommonDataSource interface from JDBC.
In the EXADataSource you can pass arguments using the setProperty() method:

EXADataSource ds = new EXADataSource();
ds.setProperty("socketfactory", "myTool.MySocketFactory");
ds.setProperty("user", "mydbuser");
...

Additionally, the JDBC driver includes an Exasol-specific implementation of the SocketFactory interface: EXASocketFactory.

Using the Exasol specific method "createCustomSocket(InetAddress host, int port, int timeout) " allows you to connect with a specified timeout.

public abstract class EXASocketFactory extends SocketFactory {
    public abstract Socket createCustomSocket(InetAddress host, int port, int timeout) throws IOException;

When more than one host is specified in a connection string, the connect attempts to each of these hosts are made using the SocketFactory specified by the user and the timeout (if given) until one host is connected.