dotConnect for DB2 is a high-performance ORM enabled data provider for DB2 that builds on ADO.NET technology. The provider works with .NET Frameworks 2.0+, .NET Core 2.0+, .NET 5+. More information at https://www.devart.com/dotconnect/db2/ License dotConnect for DB2 is available in several editions https://www.devart.com/dotconnect/db2/ordering.html The NuGet package initiates the retrieval of an activation key from the Devart website. This key is required to activate the product for a free trial. Key Features * Direct Mode: Allows your application to work with DB2 directly, without additional libraries. * ASP.NET Core: Supports ASP.NET Core Identity. * Performance: Uses many DB2-specific performance features and optimizations to ensure the highest performance. * Monitoring: Allows per-component tracing of database events with a free dbMonitor application. * Security: Supports various encryption SSL and SSH connections, etc. * Support and updates: Enjoy dedicated support team for prompt issue resolution and regular updates to keep your software running smoothly and securely.
$ dotnet add package Devart.Data.DB2dotConnect for DB2 is a high-performance ORM enabled data provider for DB2 that builds on ADO.NET technology.
The provider works with .NET Frameworks 2.0+, .NET Core 2.0+, .NET 5+.
More information at dotConnect for DB2.
For projects, using general ADO.NET functionality of dotConnect for DB2, you need to install the Devart.Data.DB2 package. Execute the following command in the Package Manager Console:
Install-Package Devart.Data.DB2
For projects, using Entity Framework Core 3, 5, 6, 7, 8, 9 with DB2, install the Devart.Data.DB2.EFCore package.
For projects that require integration with Entity Framework 6.4 (EF6), use the Devart.Data.DB2.EF6 package.
dotConnect for DB2 is available in several editions. See pricing options for ordering.
To activate your license, please download dotConnect for DB2 from our website. This installer generates the trial key files required for using this package on a trial basis.
The following table show which version of this package to use with which version of frameworks.
| Frameworks | Version support |
|---|---|
| .NET | 9, 8, 7, 6, 5 |
| .NET Core | 3, 2 |
| .NET Framework | 4.8, 4.7, 4.6.2, 4.6.1 |
More information here
In this example, a new instance of the DB2Connection class (part of the Devart.Data.DB2 namespace) is created.
using Devart.Data.DB2;
...
DB2Connection connection = new DB2Connection();
connection.Server = "db2:50000";
connection.UserId = "db2admin";
connection.Password = "mypassword";
connection.Database = "SAMPLE";This snippet simplifies the connection setup by directly assigning a connection string to the ConnectionString property of the DB2Connection object
db2Connection1.ConnectionString = "Server=db2:50000;UserId=db2admin;Password=mypassword;Database=SAMPLE";Configuration File Snippet (appsettings.json):
{
"ConnectionStrings": {
"DefaultConnection": "Server=db2:50000;UserId=db2admin;Password=mypassword;Database=SAMPLE"
}
}Dependency Injection of IConfiguration:
private readonly IConfiguration configuration;
public YourController(IConfiguration config)
{
configuration = config;
}Retrieving a Connection String:
var connectionString = configuration.GetConnectionString("DefaultConnection");
var connection = new DB2Connection(connectionString);For more information about secure connections read at our documentation.