port_ = port;
netConnection_ = netConnection;
clientSSLMode_ = clientSSLMode;
if (server_ == null) {
throw new DisconnectException(this,
new ClientMessageId(SQLState.CONNECT_REQUIRED_PROPERTY_NOT_SET),
"serverName");
}
try {
socket_ = (java.net.Socket) java.security.AccessController.doPrivileged(new OpenSocketAction(server, port, clientSSLMode_));
} catch (java.security.PrivilegedActionException e) {
throw new DisconnectException(this,
new ClientMessageId(SQLState.CONNECT_UNABLE_TO_CONNECT_TO_SERVER),
new Object[] { e.getException().getClass().getName(), server,
Integer.toString(port), e.getException().getMessage() },
e.getException());
}
// Set TCP/IP Socket Properties
try {
if (exceptionOpeningSocket_ == null) {
socket_.setTcpNoDelay(true); // disables nagles algorithm
socket_.setKeepAlive(true); // PROTOCOL Manual: TCP/IP connection allocation rule #2
socket_.setSoTimeout(loginTimeout * 1000);
}
} catch (java.net.SocketException e) {
try {
socket_.close();
} catch (java.io.IOException doNothing) {
}
exceptionOpeningSocket_ = new DisconnectException(this,
new ClientMessageId(SQLState.CONNECT_SOCKET_EXCEPTION),
e.getMessage(), e);
}
try {
if (exceptionOpeningSocket_ == null) {
rawSocketOutputStream_ = socket_.getOutputStream();
rawSocketInputStream_ = socket_.getInputStream();
}
} catch (java.io.IOException e) {
try {
socket_.close();
} catch (java.io.IOException doNothing) {
}
exceptionOpeningSocket_ = new DisconnectException(this,
new ClientMessageId(SQLState.CONNECT_UNABLE_TO_OPEN_SOCKET_STREAM),
e.getMessage(), e);
}
sourceCcsidManager_ = new EbcdicCcsidManager(); // delete these