[英]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.