JustyBase.NetezzaDriver 0.0.1

There is a newer version of this package available.
See the version list below for details.
dotnet add package JustyBase.NetezzaDriver --version 0.0.1                
NuGet\Install-Package JustyBase.NetezzaDriver -Version 0.0.1                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="JustyBase.NetezzaDriver" Version="0.0.1" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add JustyBase.NetezzaDriver --version 0.0.1                
#r "nuget: JustyBase.NetezzaDriver, 0.0.1"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install JustyBase.NetezzaDriver as a Cake Addin
#addin nuget:?package=JustyBase.NetezzaDriver&version=0.0.1

// Install JustyBase.NetezzaDriver as a Cake Tool
#tool nuget:?package=JustyBase.NetezzaDriver&version=0.0.1                

JustyBase.NetezzaDriver

JustyBase.NetezzaDriver is a .NET library for interacting with IBM Netezza Performance Server databases. It provides a set of classes and methods to facilitate database connections, command execution, and data retrieval. Code is is based on nzpy and npgsql

⚠️ Warning: This project is currently under active development and is not yet ready for production use. The API may have significant changes before the first stable release.

Features

  • Connect to Netezza databases using NzConnection.
  • Execute SQL commands and queries with NzCommand.
  • Read data using NzDataReader.
  • Support for various Netezza data types.
  • Secure connections with SSL/TLS.

Requirements

  • .NET 8 or .NET 9
  • C# 12.0

Installation

JustyBase.NetezzaDriver is available as a NuGet package. You can install it using the following command:

dotnet add package JustyBase.NetezzaDriver

Usage

Connecting to a Database

To connect to a Netezza database, create an instance of NzConnection and open the connection:

using JustyBase.NetezzaDriver;

var connection = new NzConnection("username", "password", "host", "database");
connection.Open();

Executing a Command

var command = new NzCommand(connection)
{
    CommandText = "SELECT * FROM my_table"
};

using var reader = command.ExecuteReader();
while (reader.Read())
{
    for (int i = 0; i < reader.FieldCount; i++)
    {
        var value = reader.GetValue(i);
        Console.WriteLine(value);
    }
}

Handling Transactions

To handle transactions, use the BeginTransaction, Commit, and Rollback methods:

        using NzConnection connection = new NzConnection("username", "password", "host", "database");
        connection.Open();
        using var cursor = connection.CreateCommand();

        connection.AutoCommit = false; // autocommit is on by default. It can be turned off by using the autocommit property of the connection.

        cursor.CommandText = "DROP TABLE T2 IF EXISTS";
        cursor.ExecuteNonQuery();
        cursor.CommandText = "create table t2(c1 numeric (10,5), c2 varchar(10),c3 nchar(5))";
        cursor.ExecuteNonQuery();
        cursor.CommandText = "insert into t2 values (123.54,'xcfd','xyz')";
        cursor.ExecuteNonQuery();
        connection.Rollback();
        cursor.CommandText = "DROP TABLE T5 IF EXISTS";
        cursor.ExecuteNonQuery();
        cursor.CommandText = "create table t5(c1 numeric (10,5), c2 varchar(10),c3 nchar(5))";
        cursor.ExecuteNonQuery();
        cursor.CommandText = "insert into t5 values (123.54,'xcfd','xyz')";
        cursor.ExecuteNonQuery();
        connection.Commit();

        cursor.CommandText = "SELECT * FROM T2";
        Assert.Throws<NetezzaException>(() => cursor.ExecuteNonQuery());
        try
        {
            cursor.CommandText = "SELECT * FROM T5";
            cursor.ExecuteNonQuery();
        }
        catch (Exception ex)
        {
            Assert.Fail( $"Expected no exception, but got: {ex.Message}");
        }

Secure Connections

⚠️ Warning Aboring the secure connection is not implemented yet. This feature in not well tested. PR's are welcome.

To establish a secure connection, provide the SSL certificate file path when creating the NzConnection instance:

var connection = new NzConnection("username", "password", "host", "database", securityLevel: 3, sslCerFilePath: "path/to/certificate.pem");
connection.Open();

Testing

To run the tests, use the following command:

dotnet test

License

License

This project is licensed under the Apache License, Version 2.0 - see the LICENSE file for details.

Copyright: 2025 Krzysztof Duśko
Copyright: 2019-2020 IBM, Inc

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

Contact

For questions or support, please open an issue on GitHub.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net8.0

    • No dependencies.
  • net9.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
0.0.2 62 1/19/2025
0.0.1 81 1/11/2025