How can I connect to to Clusterpoint database using C#?

136 views Asked by At

I have downloaded the API files. I am not sure how to perform a connection to Clusterpoint database. When I run this code I get a message "connection string error". It would help to also provide a reference to a complete crud example that works. Thx.

string _url = @"https://api-eu.clusterpoint.com/v4";        //eu is correct
string _dbName = "db1";
string _username = "[email protected]";                //not real
string _password = "...";                          //not real
string _document = "document";
string _documentID = "//document/id";
Dictionary<string, string> 
_dic = new Dictionary<string, string>(){ { "account", "0000" } };  //0000 not real

try
{
    CPS_Connection cpsConnection = new CPS_Connection(_url, _dbName, _username, _password, 
                                                      _document, _documentID, _dic);

    /* CPS_Connection cpsConnection = new CPS_Connection(
        "tcp://SERVER_IP:SERVER_PORT", "example", "username",        
        "password", "document",
        "/document/id", new Dictionary<string, string>() 
        { { "account", "<YOUR_ACCOUNT_ID>" } });
    */
}
catch (Exception e)
{
    Console.WriteLine("Connection Error...."+e.Message);
    Console.Read();
    return;
}
1

There are 1 answers

0
Marija On

If you have created Clusterpoint v4 database, then you can use only REST to connect to database and execute commands, because Clusterpoint v4 currently provides only REST API. Connection code samples for v4 could be found in Clusterpoint documentation: https://www.clusterpoint.com/docs/?page=5-Connection&version=4

If you plan to create v3 database, then you can download appropriate .NET API library and follow the examples here: https://www.clusterpoint.com/docs/?page=5-Connection&language=.NET&version=3