Skip to content

Dot .Net Framework C# DB2 Library example and setup. Made to hopefully save you some time with these examples.

License

Notifications You must be signed in to change notification settings

cmilius/NetDb2Example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NetDb2Example

Table of Contents

About The Project

This is an example for how to connect to and use an IBM DB2 database with the .Net Framework. Went through a lot of pain figuring out the quirks/nuances of DB2 in a Windows .Net environment...so I put this sample project together to hopefully help you avoid most of the pain. This project does not outline how to set up a DB2 database, only how to connect and consume it's data.

Disclaimer: I do not reccomend using IBM DB2 if you are working in a Windows environment...use only if required.

Built With

Getting Started

IBM DB2 Client

An IBM DB2 client must be installed on the host machine. Get install files from IBM or your IT administrator. Follow the prompts in the wizard leave the defaults. I also recommend installing the Visual Studio Plugin for data viewing (just check the box on install).

IBM Windows Groups & Execution Permissions

After installing the client, you will notice two new Windows groups. You have to add users to the DB2ADMNS or DB2USERS groups that will execute local DB2 applications and tools on the host machine.

  1. Open Local Users and Groups
lusrmgr.msc
  1. Select Groups folder
  2. Add users who will be executing DB2 command to the DB2ADMNS or DB2USERS groups

Connection Methods

Microsoft Open Database Connectivity (ODBC)

This method is the easiest to set up, though is slower with query execution. This is to be expected since it is a generic database driver. No extra Nuget packages are required with this route. The only real differences are in the connection string and the classes used when querying the database.

IBM.Data.DB2

This method is more difficult to set up, though is faster with query execution once configured correctly.

Data Clients

Visual Studio Add-in

The Visual Studio Add-in can be included in the install of the IBM DB2 Client. Just be sure to check the box. After installing the add-in and restarting Visual Studio, you should be able to use the Server Explorer (Ctrl-Alt-S) to connect to an IBM DB2 Database instance.

IBM DB2 Data Studio

IBM DB2 Data Studio is IBM's take on SQL Server Management Studio (SSMS). It's built in a gutted version of the Eclipse IDE. It works...it's just clunky. You can download and install it from IBM's site.

IIS Configuration

The only real thing you will need to do is give your ApplicationPoolIdentity access to one of the DB2 Windows groups. This can be an account you specify, or the default IIS ApplicationPoolIdentity (ex. IISAppPool\DefaultAppPool)

Contributing

If you'd like to contribute or help me add more examples, I encourage it! Please fork the project and make your changes. I'd love to see see/merge them with mine. See the open issues for a list of proposed features (and known issues).

License

Distributed under the MIT License. See LICENSE for more information.

Contact

Project Link: https://github.com/cmilius/NetDb2Example

About

Dot .Net Framework C# DB2 Library example and setup. Made to hopefully save you some time with these examples.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published