UltipaDocs
Try Playground
  • Introduction
    • Installation
    • Connection
      • Overview and Request Configuration
      • UQL Execution
      • GQL Execution
      • Graph
      • Schema and Property
      • Data Insertion
      • Query Acceleration
      • HDC Graph and Algorithm
      • Data Export
      • Process and Job
      • Access Control
    • Result Processing
    • Driver Data Classes
    • Installation
    • Connection
      • Overview and Request Configuration
      • UQL Execution
      • GQL Execution
      • Graph
      • Schema and Property
      • Data Insertion
      • Query Acceleration
      • HDC Graph and Algorithm
      • Data Export
      • Process and Job
      • Access Control
    • Result Processing
    • Driver Data Classes
    • Quick Start
    • Connect to Database
    • Query the Database
      • Graph
      • Schema and Property
      • Data Insertion
      • Query Acceleration
      • HDC Graph and Algorithm
      • Data Export
      • Process and Job
      • Access Control
    • Process Query Results
    • Data Structures
    • Quick Start
    • Connect to Database
    • Query the Database
      • Graph
      • Schema and Property
      • Data Insertion
      • Query Acceleration
      • HDC Graph and Algorithm
      • Data Export
      • Process and Job
      • Access Control
    • Process Query Results
    • Data Structures
    • Installation
    • Connection
    • Request Configuration
    • UQL Execution
    • GQL Execution
    • Graphset Management
    • Schema and Property Management
    • Data Insertion and Deletion
    • Query Acceleration
    • Algorithm Management
    • Downloads and Exports
    • Process and Task Management
    • Access Management
    • Server Statistics
    • Result Processing
    • Types Mapping Ultipa and C#
  • RESTful API
  1. Docs
  2. /
  3. Ultipa Drivers
  4. /
  5. C#

Connection

After installing the Ultipa C# SDK and setting up a running Ultipa instance, you should be able to connect your application to the Ultipa graph database.

Code Configuration Connection

Connection to Ultipa can be established by using UltipaConfig, which specifies the information of the connection needed.

Connect to a Cluster

C#
using UltipaSharp;
using UltipaSharp.configuration;

class Program
{
    static void Main(string[] args)
    {
        var ultipa = new Ultipa(new UltipaConfig()
        {
            Hosts = new[] { "192.168.1.85:60061", "192.168.1.86:60061", "192.168.1.87:60061" },
            CurrentGraph = "default",
            Username = "***",
            Password = "***",
        });
        Console.WriteLine("Connected to the graph database!");
    }
}

Connect to Ultipa Cloud with TSL

C#
using UltipaSharp;
using UltipaSharp.configuration;
using UltipaSharp.connection;

class Program
{
   
    static void Main(string[] args)
    {
        var ultipa = new Ultipa(new UltipaConfig()
        {
            Hosts = new[]{ "xaznryn5s.us-east-1.cloud.ultipa.com:60010" },
            CurrentGraph = "myGraph",
            Username = "***",
            Password = "***",
            Protocol = "***"
        });

        Console.WriteLine("Connected to Ultipa Cloud!");

    }

}

Configuration Items

Below are all the configuration items available for UltipaConfig:

Item
Type
Default
Description
Hostsstring[]Database host addresses or URI (excluding https:// or http://). For clusters, multiple addresses are separated by commas. Required.
UsernamestringUsername of the host authentication. Required.
PasswordstringPassword of the host authentication. Required.
Crtchar[]Certificate file for encrypted messages.
PasswordEncryptenumMD5Password encryption method of the driver. Supports MD5, LDAP and NOTHING. NOTHING is used when the content is blank.
CurrentGraphstringdefaultName of the current graphset.
ProtocolstringhttpProtocol type.
ConsistencyboolfalseWhether to use the leader node to ensure consistency read.
ClusterIdstringCluster ID of the nameserver.
MaxRecvSizeint64Maximum size in megabytes when receiving data.
Timeoutuint15uRequest timeout threshold in seconds.
DebugboolfalseWhether to use the debug mode.
HeartBeatint0Heartbeat interval in milliseconds for all instances, set 0 to disable heartbeat.

Connection Test

The test() method on a Connection object can be used for checking the driver connection.

C#
var res = ultipa.Test();
Console.WriteLine("Test succeeds: " + res);
Output
Test succeeds: True