if (connectionOptions != null && connectionOptions.size() > 0) {
if (connectionOptions.containsKey(PARAM_DB_TYPE))
connectionDbType = connectionOptions.get(PARAM_DB_TYPE).toString();
}
OChannelBinaryAsynchClient network = null;
String currentURL = getCurrentServerURL();
do {
do {
try {
network = getAvailableNetwork(currentURL);
try {
network.writeByte(OChannelBinaryProtocol.REQUEST_DB_OPEN);
network.writeInt(getSessionId());
// @SINCE 1.0rc8
sendClientInfo(network);
network.writeString(name);
if (network.getSrvProtocolVersion() >= 8)
network.writeString(connectionDbType);
network.writeString(connectionUserName);
network.writeString(connectionUserPassword);
} finally {
endRequest(network);
}
final int sessionId;
try {
beginResponse(network);
sessionId = network.readInt();
setSessionId(network.getServerURL(), sessionId);
OLogManager.instance().debug(this, "Client connected to %s with session id=%d", network.getServerURL(), sessionId);
readDatabaseInformation(network);
// READ CLUSTER CONFIGURATION
updateClusterConfiguration(network.readBytes());
// read OrientDB release info
if (network.getSrvProtocolVersion() >= 14)
network.readString();
status = STATUS.OPEN;
return;