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.
Check out http://asna.com/us/ as they have some development tools working with SQL and the AS400.
I'm using this code and work very good for me!
Following is what I did to resolve the issue.
Installed the
IBM i Access for Windows
. Not freeReferred the following dlls in the project
Data Access
Connection String
UPDATE
IBM i Access Client Solutions
As mentioned in other answers, if you have the IBM i Access client already installed, you can use the IBM.Data.DB2.iSeries package.
If you don't have the IBM i Access software, you can leverage JTOpen and use the Java drivers. You'll need the nuget package JT400.78 which will pull in the IKVM Runtime.
In my case I needed to query a DB2 database on an AS400 and output a DataTable. I found several hints and small snippets of code but nothing comprehensive so I wanted to share what I was able to build up in case it helps someone else:
The conversion from RecordSet to DataTable is a little clunky and gave me bad flashbacks to my VBScript days. Performance likely isn't blinding fast, but it works.
Extremely old question - but this is still relevant. I needed to query our AS/400 using .NET but none of the answers above worked and so I ended up creating my own method using OleDb:
And you would use it like so:
It returns a
DataSet
of the results returned. If anyone needs/wants a method for inserting/updating values within the IBM AS/400, leave a comment and I'll share...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