繁体   English   中英

如何使用C#连接到Clusterpoint数据库?

[英]How can I connect to to Clusterpoint database using C#?

我已经下载了API文件。 我不确定如何执行与Clusterpoint数据库的连接。 当我运行此代码时,我收到一条消息“连接字符串错误”。 这也有助于提供一个完整的有效示例的参考。 谢谢。

string _url = @"https://api-eu.clusterpoint.com/v4";        //eu is correct
string _dbName = "db1";
string _username = "a@hotmail.com";                //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;
}

如果已创建Clusterpoint v4数据库,则只能使用REST连接到数据库并执行命令,因为Clusterpoint v4当前仅提供REST API。 可以在Clusterpoint文档中找到v4的连接代码示例: https ://www.clusterpoint.com/docs/ ? page =5- Connection & version =4

如果您打算创建v3数据库,则可以下载适当的.NET API库并按照此处的示例操作: https : //www.clusterpoint.com/docs/?page=5-Connection&language= .NET &version=3

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM