This article is deprecated.
Start the connection pool, and synchronously connect all worker processes.
Prototype
bool open(char const* const* nodes, int nNodes, int nReplicas = 1, ReplicationType replType = SQL_REPLICATION, int maxConnectAttempts = 10, int* badNode = NULL, bool localDomain = false, void* sslParameters = NULL, timer_unit connectTimeout = 2*1000, timer_unit readTimeout = 1200*1000);Arguments
nodesAn array with the node names and ports ("NAME:PORT").nNodesThe number of nodes.nReplicasThe number of replicas; this number should be a divisor ofnNodes, meaning that the remainder ofnNodes / nReplicasis0. For example, the values ofnNodesandnReplicascould be (4 and 2) or (12 and 3) but not (6 and 4) because 6 % 4 = 2.replTypeThe replication method.maxConnectAttemptsThe maximum number of attempts to connect to the server.badNodeIf this parameter is not null and the open fails, then the index of the node specification innodesfor the node that could not be connected is stored inbadNode.localDomainIndicates that a Unix domain socket instead of a networked TCP socket is used for RSQL communication, which is possible only when the server and client are on the same host.sslParametersA pointer to amco_ssl_params_tstructure containing SSL connection settings.connectTimeoutThe timeout for each connection attempt in milliseconds; the total connection time can be up toconnectTimeout * maxConnectAttemptsmilliseconds.readTimeoutThe timeout for read operations in milliseconds.Description
This method opens an eXtremeDB database, an eXtremeDB SQL mapper and the AsyncDistributedSqlEngine instance with the list of parameters specified. Internally, it creates worker processes, each of which handles connections, sends queries and receives results.
Returns
This method returns
trueif the connection to the server was successfully established,falseotherwise.Example
const size_t nWorkers = 4; const char *nodes[] = { "localhost:5001", "localhost:5002" }; int main(int argc, char** argv) { try { McoSql::AsyncDistributedSqlEngine engine(nWorkers); if (!engine.open(nodes, sizeof(nodes) / sizeof(nodes[0]))) { printf("Open failed: %s\n", engine.getError()->cstr()); return 1; } ... } }