How to execute Store Procudure on IBM AS400-iSeries-System database ?


Recently i got the chance to work with IBM AS400-iSeries-System database i.e mainframe database. Process is very much similar to approach.

Firstly you have to install drive i.e IBM i Access for Windows

Then add the IBM.Data.DB2.iSeries dll in your application.

Now you can write the code like this.

Imports IBM.Data.DB2.iSeries

Public Class Form1

    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click

 Dim con As New iDB2Connection("Data source=;User Id=Test;Password=Test")
        Dim cmd As New iDB2Command()
        cmd = con.CreateCommand()
        cmd.CommandText = "trs.Test"
        cmd.CommandType = CommandType.StoredProcedure
        cmd.Parameters.AddWithValue("@lib1", "TEL")
        cmd.Parameters.AddWithValue("@sUser", "admin")
        cmd.Parameters.AddWithValue("@ErrorMsgId", "")
        cmd.Parameters.AddWithValue("@ErrorMsg", "")
        cmd.Parameters("@ErrorMsgId").Direction = ParameterDirection.Output
        cmd.Parameters("@ErrorMsg").Direction = ParameterDirection.Output
        Dim da As New iDB2DataAdapter(cmd)
        Dim dt As New DataTable()
        Dim msg As String = cmd.Parameters("@ErrorMsgId").Value
        Dim msg1 As String = cmd.Parameters("@ErrorMsg").Value

    End Sub

End Class

It will fetch the data from database.

How to use Corflags tool of Visual Studio to check 32/64 bit of dll ?


Corflags is the inbuilt tool of Visual Studio which is used to find out the type of .dll i.e 32 bit, 64 bit or any CPU. This tool is available in Visual studio 2005 onward. i.e. VS 2005/2008/2010/2013

These are the following steps to check in Visual Studio

Step1 : Go to visual Studio command prompt like this


Step 2: Make Sure that Corflags is working in your system

Type the Corflags in Command Prompt like this


Note: if this syntax is not working then there is some problem in Environment Variable of the System
You can fix this issue like this post

Step 3: Go to the file Location of DLL and type the syntax like this in below image
Corflags AjaxToolKit.dll


This is the short summary to determine the type of dll

Any CPU: PE = PE32 and 32BIT = 0
x86 bit: PE = PE32 and 32BIT = 1
64-bit: PE = PE32+ and 32BIT = 0

I hope this will help to some body.

How to install oracle Client 64 bit ?


If you are connecting with oracle database then there is not mandatory to install oracle server in each machine. We can install the oracle client, then we can connect with database. But for install of oracle client we can do like this.

Step 1: Make ensure that software is for 64 bit.

Step 2: Click on Setup

Step 3: Select “RunTime” then click on Next

Oracle Client

Step 4: Go to the path of install oracle client 64 bit software like this path

And change the tnsnames like this

(PORT = 1521)
(SID = db1)

Now using this TESTDB tns name we can connect with database.