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 Constructor Description ConnectionHelper()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description 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.
-
-
-
Method Detail
-
createSocket
public static Socket createSocket(Configuration conf, HostAddress hostAddress) throws IOException, SQLException
Create socket accordingly to options.- Parameters:
conf
- Url optionshostAddress
- host ( mandatory but for named pipe / unix socket)- Returns:
- a nex socket
- Throws:
IOException
- if connection error occurSQLException
- in case of configuration error
-
standardSocket
public static Socket standardSocket(Configuration conf, HostAddress hostAddress) throws IOException, SQLException
Use standard socket implementation.- Parameters:
conf
- url optionshostAddress
- 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
-
-