OceanBase
English日本語简体中文
Docs Home
Products
Integrations
Release Notes

Databases

OceanBase DatabaseOceanBase Cloud OceanBase Best Practices

Tools

OceanBase Cloud PlatformOceanBase Migration ServiceOceanBase Developer CenterOceanBase Migration AssessmentOceanBase Admin ToolOceanBase Loader and DumperOceanBase DeployerKubernetes operator for OceanBaseOceanBase Diagnostic Tool OceanBase Binlog Service

Connectors and Middleware

OceanBase Database Proxy OceanBase Connector/C OceanBase Connector/J OceanBase Connector/ODBC OceanBase Connector/NETOceanBase Command-Line Client

Databases

OceanBase DatabaseOceanBase Cloud OceanBase Best Practices

Connectors and Middleware

OceanBase Database Proxy OceanBase Connector/C OceanBase Connector/J OceanBase Connector/ODBC OceanBase Connector/NETOceanBase Command-Line Client

Tools

OceanBase Cloud PlatformOceanBase Migration ServiceOceanBase Developer CenterOceanBase Migration AssessmentOceanBase Admin ToolOceanBase Loader and DumperOceanBase DeployerKubernetes operator for OceanBaseOceanBase Diagnostic Tool OceanBase Binlog Service
OceanBase DatabaseOceanBase Cloud ToolsConnectors and MiddlewareLifecycle Support Policy

OceanBase Connector/NET

V1.0.0
  • What Is OceanBase Connector/NET
    • Introduction
  • Install and Connect
    • Installation process
    • Test the connection
    • Reference a NuGet package
  • User Guide
    • Quick Start
      • Complete example
    • Connection Strings and Data Source
      • Connection strings
    • Data Types
      • Overview of data types
    • Command and Parameter
      • Overview
    • Result Set
      • Supported result set types
  • Reference Information
    • Common Interfaces
      • Overview of commonly used interfaces
  • Version Release Records
    • OceanBase Connector/NET V1.0.0

Download PDF

Document Feedback
  1. Documentation Center
  2. OceanBase Connector/NET
  3. V1.0.0

Installation process

Last Updated:2026-09-04 08:24:51

Environment preparation
Procedure
Step 1: Install the .NET runtime environment
Step 2: Create a console project
Step 3: Install OceanBase Connector/NET
Step 4: Write a connection sample code
Step 5: Run the connection verification
References

This topic describes the complete process of using OceanBase Connector/NET, including environment preparation, project creation, driver installation, and connection verification.

Note

The examples in this topic are based on a Linux environment and an Oracle tenant. If you use Windows or MySQL mode, you can follow the same steps to complete the installation and connection.

Environment preparation

  • An accessible OceanBase Database instance.
  • Database account, password, host address, and port information.
  • .NET SDK installed (Linux/macOS command examples are provided).

Notice

Before installing .NET 10.0 on Linux, make sure that your system meets the glibc version requirements.

Procedure

Step 1: Install the .NET runtime environment

For Windows, you can download the installation package from the Microsoft official website. For Linux/macOS, run the following command:

Note

This topic uses .NET 10.0 as an example. In practice, you can choose other supported .NET versions based on project compatibility requirements. The installation steps are the same.

wget https://dot.net/v1/dotnet-install.sh -O dotnet-install.sh
chmod +x dotnet-install.sh
./dotnet-install.sh --channel 10.0
echo 'export PATH="$HOME/.dotnet:$HOME/.dotnet/tools:$PATH"' >> ~/.bashrc
source ~/.bashrc

Verify the installation result:

dotnet --version

If the output is 10.0.0 or a higher version, the installation is successful.

Step 2: Create a console project

mkdir dotnet-test
cd dotnet-test
dotnet new console
dotnet run

If the console output is Hello, World!, the project is created successfully.

Step 3: Install OceanBase Connector/NET

After downloading the driver to your local machine, run the following command in the project directory to install the driver:

dotnet add <your project.csproj> package Oceanbase.ManagedDataAccess --version 1.0.0 --source "<package repository>" --source "https://api.nuget.org/v3/index.json"

Note

If you use the official NuGet package source, retain --source "https://api.nuget.org/v3/index.json".

You can also modify the nuget.config file, for example:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <packageSources>
    <add key="local-oceanbase" value="driver download directory" />
    <add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
  </packageSources>
</configuration>

After the installation is successful, you can see the following configuration in the .csproj file:

<ItemGroup>
  <PackageReference Include="Oceanbase.ManagedDataAccess" Version="1.0.0" />
</ItemGroup>

Step 4: Write a connection sample code

Modify the Program.cs file as follows:

using Oceanbase;

namespace Program
{
    class Program
    {
        static void Main(string[] args)
        {
            OracleConnection conn = new OracleConnection("Server=xxxxx;Port=5858;Database=test;User Id=test@oracle;Password=test;");

            try
            {
                conn.Open();
                OracleCommand cmd = new OracleCommand("select to_char(sysdate, 'yyyy-MM-dd HH24:mi:ss') from dual ", conn);
                var reader = cmd.ExecuteReader();
                while (reader.Read())
                {
                    Console.WriteLine("sysdate is:" + reader.GetString(0));
                }

            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
            finally
            {
                conn.Close();
            }
        }
    }
}

Step 5: Run the connection verification

dotnet run

If the current time is output, the connection and query are successful.

References

  • Package references and usage instructions
  • Connection test

Previous topic

Introduction
Last

Next topic

Test the connection
Next
on this page
Environment preparation
Procedure
Step 1: Install the .NET runtime environment
Step 2: Create a console project
Step 3: Install OceanBase Connector/NET
Step 4: Write a connection sample code
Step 5: Run the connection verification
References