HuaweiCloud.Driver.GaussDB

GaussDB is the open source .NET data provider for GaussDB/OpenGauss.


Keywords
ado, ado.net, database, gaussdb, openguass, sql
License
PostgreSQL
Install
Install-Package HuaweiCloud.Driver.GaussDB -Version 0.1.0

Documentation

GaussDB Driver

HuaweiCloud.Driver.GaussDB Latest Preview

PostgreSQL License

What is GaussDB ?

GuassDB is an open-source database driver led by Huawei's open-source community and refactored based on npgsql. It is compatible with openGauss and Guass databases. Open Source for Huawei revolves around Huawei's technology ecosystems including Kunpeng, Ascend, HarmonyOS, and Huawei Cloud. Through collaboration with developers from enterprises, universities, and the open-source community, it enables adaptation development and solution validation for open-source software, ensuring smoother and more efficient operation on Huawei Cloud.

Before getting started, developers can download the Open Source for Huawei Wiki to access detailed development procedures, technical preparations, and various resources required throughout the development process. If you have any questions during use, please visit the GaussDB forum for discussion.

Quick start

Here's a basic code snippet to get you started:

using HuaweiCloud.GaussDB;

var connString = "Host=myserver;Username=mylogin;Password=mypass;Database=mydatabase";

var dataSourceBuilder = new GaussDBDataSourceBuilder(connString);
var dataSource = dataSourceBuilder.Build();

var conn = await dataSource.OpenConnectionAsync();

await using (var cmd = new GaussDBCommand("INSERT INTO data (some_field) VALUES (@p)", conn))
{
    cmd.Parameters.AddWithValue("p", "Hello world");
    await cmd.ExecuteNonQueryAsync();
}

await using (var cmd = new GaussCommand("SELECT some_field FROM data", conn))
await using (var reader = await cmd.ExecuteReaderAsync())
{
    while (await reader.ReadAsync())
        Console.WriteLine(reader.GetString(0));
}

License

This project is released under of the PostgreSQL License.