Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Connect to AS400 using .NET

I am trying to build a .NET web application using SQL to query AS400 database. This is my first time encountering the AS400.

What do I have to install on my machine (or the AS400 server) in order to connect? (IBM iSeries Access for Windows ??)

What are the components of the connection string?

Where can I find sample codes on building the Data Access Layer using SQL commands?

Thanks.

like image 795
madatanic Avatar asked Jul 26 '10 16:07

madatanic


People also ask

What database does AS400 use?

Furthermore, the traditional IBM AS/400 system is leveraged with RPG, newer IBM AS400 host RPG applications, and some unique applications like Java. Also, it is integrated with server technology like “DB2” universal database and “Lotus Domino” software.


2 Answers

You need the AS400 .Net data provider. Check here: https://www-01.ibm.com/support/docview.wss?uid=isg3T1027163

For connection string samples, check here: https://www.connectionstrings.com/as-400/

Also, check out the redbook for code examples and getting started. http://www.redbooks.ibm.com/redbooks/pdfs/sg246440.pdf

like image 171
dcp Avatar answered Sep 17 '22 05:09

dcp


Following is what I did to resolve the issue.

Installed the IBM i Access for Windows. Not free

Referred the following dlls in the project

  • IBM.Data.DB2.iSeries.dll
  • Interop.cwbx.dll (If Data Queue used)
  • Interop.AD400.dll (If Data Queue used)

Data Access

  using (iDB2Command command = new iDB2Command())         {             command.Connection = (iDB2Connection)_connection;             command.CommandType = CommandType.Text;             command.Parameters.AddWithValue(Constants.ParamInterfaceTransactionNo, 1);             command.CommandText = dynamicInsertString;             command.ExecuteScalar();         } 

Connection String

<add name="InterfaceConnection"  connectionString="Data Source=myserver.mycompany.com;User ID=idbname;Password=mypassxxx; Default Collection=ASIPTA;Naming=System"/> 

UPDATE

i Access for Windows on operating systems beyond Windows 8.1 may not be supported. Try the replacement product IBM i Access Client Solutions

IBM i Access Client Solutions

like image 29
LCJ Avatar answered Sep 21 '22 05:09

LCJ