JustyBase.NetezzaDriver
0.0.2
dotnet add package JustyBase.NetezzaDriver --version 0.0.2
NuGet\Install-Package JustyBase.NetezzaDriver -Version 0.0.2
<PackageReference Include="JustyBase.NetezzaDriver" Version="0.0.2" />
paket add JustyBase.NetezzaDriver --version 0.0.2
#r "nuget: JustyBase.NetezzaDriver, 0.0.2"
// Install JustyBase.NetezzaDriver as a Cake Addin #addin nuget:?package=JustyBase.NetezzaDriver&version=0.0.2 // Install JustyBase.NetezzaDriver as a Cake Tool #tool nuget:?package=JustyBase.NetezzaDriver&version=0.0.2
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 nzCommand = connection.CreateCommand();
connection.AutoCommit = false; // autocommit is on by default. It can be turned off by using the autocommit property of the connection.
nzCommand.CommandText = "DROP TABLE T2 IF EXISTS";
nzCommand.ExecuteNonQuery();
nzCommand.CommandText = "create table t2(c1 numeric (10,5), c2 varchar(10),c3 nchar(5))";
nzCommand.ExecuteNonQuery();
nzCommand.CommandText = "insert into t2 values (123.54,'xcfd','xyz')";
nzCommand.ExecuteNonQuery();
connection.Rollback();
nzCommand.CommandText = "DROP TABLE T5 IF EXISTS";
nzCommand.ExecuteNonQuery();
nzCommand.CommandText = "create table t5(c1 numeric (10,5), c2 varchar(10),c3 nchar(5))";
nzCommand.ExecuteNonQuery();
nzCommand.CommandText = "insert into t5 values (123.54,'xcfd','xyz')";
nzCommand.ExecuteNonQuery();
connection.Commit();
nzCommand.CommandText = "SELECT * FROM T2";
Assert.Throws<NetezzaException>(() => nzCommand.ExecuteNonQuery());
try
{
nzCommand.CommandText = "SELECT * FROM T5";
nzCommand.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
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 | Versions 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. |
-
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.