Package org.mariadb.jdbc.client.impl

## Class ConnectionHelper

- java.lang.Object
- - org.mariadb.jdbc.client.impl.ConnectionHelper

    public final class ConnectionHelper
    extends Object

### Constructor Summary

Constructors
`ConnectionHelper()`

### Method Summary

All Methods Static Methods Concrete Methods
`static void` `authenticationHandler​(Credential credential, Writer writer, Reader reader, org.mariadb.jdbc.client.Context context)`
`static Socket` `connectSocket​(Configuration conf, HostAddress hostAddress)`
`static Socket` `createSocket​(Configuration conf, HostAddress hostAddress)` Create socket accordingly to options.
`static byte` `decideLanguage​(InitialHandshakePacket handshake)` Default collation used for string exchanges with server.
`static long` `initializeClientCapabilities​(Configuration configuration, long serverCapabilities)`
`static Credential` `loadCredential​(CredentialPlugin credentialPlugin, Configuration configuration, HostAddress hostAddress)`
`static SSLSocket` `sslWrapper​(HostAddress hostAddress, Socket socket, long clientCapabilities, byte exchangeCharset, org.mariadb.jdbc.client.Context context, Writer writer)`
`static Socket` `standardSocket​(Configuration conf, HostAddress hostAddress)` Use standard socket implementation.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Constructor Detail

#### ConnectionHelper

    public ConnectionHelper()

### Method Detail

#### createSocket

    public static Socket createSocket​(Configuration conf,
                                      HostAddress hostAddress)
                               throws IOException,
                                      SQLException

Create socket accordingly to options.

Parameters:
  `conf` - Url options
  `hostAddress` - host ( mandatory but for named pipe / unix socket)
Returns:
  a nex socket
Throws:
  `IOException` - if connection error occur
  `SQLException` - in case of configuration error

#### standardSocket

    public static Socket standardSocket​(Configuration conf,
                                        HostAddress hostAddress)
                                 throws IOException,
                                        SQLException

Use standard socket implementation.

Parameters:
  `conf` - url options
  `hostAddress` - host to connect
Returns:
  socket
Throws:
  `IOException` - in case of error establishing socket.
  `SQLException` - in case host is null

#### connectSocket

    public static Socket connectSocket​(Configuration conf,
                                       HostAddress hostAddress)
                                throws SQLException

Throws:
  `SQLException`

#### initializeClientCapabilities

    public static long initializeClientCapabilities​(Configuration configuration,
                                                    long serverCapabilities)

#### decideLanguage

    public static byte decideLanguage​(InitialHandshakePacket handshake)

Default collation used for string exchanges with server. Always return 4 bytes utf8 collation for server that permit it.

Parameters:
  `handshake` - initial handshake packet
Returns:
  collation byte

#### authenticationHandler

    public static void authenticationHandler​(Credential credential,
                                             Writer writer,
                                             Reader reader,
                                             org.mariadb.jdbc.client.Context context)
                                      throws SQLException,
                                             IOException

Throws:
  `SQLException`
  `IOException`

#### loadCredential

    public static Credential loadCredential​(CredentialPlugin credentialPlugin,
                                            Configuration configuration,
                                            HostAddress hostAddress)
                                     throws SQLException

Throws:
  `SQLException`

#### sslWrapper

    public static SSLSocket sslWrapper​(HostAddress hostAddress,
                                       Socket socket,
                                       long clientCapabilities,
                                       byte exchangeCharset,
                                       org.mariadb.jdbc.client.Context context,
                                       Writer writer)
                                throws SQLException,
                                       IOException

Throws:
  `SQLException`
  `IOException`