Does ASP.Net 2.0 have a way to connect to an AS400 DB2 database? We currently push alot of our information into SQL for use on our website but we are now wondering if we can go directly to the AS400 to get data...
I did some searching online, and it looks like the SqlDataSource allows you to connect to an ODBC data source. I was under the impression that the SqlDataSource was specific to Sql Server, but that appears to be incorrect.
However, I'm not sure how that would play into the DataSource objects with .NET 2.0. There is a good chance that they would work together if IBM implements the correct interfaces.
The best way I have found to access DB2/400 is by using the DB2.Net data provider that comes with IBM's Client Access product. This is a licensed product so you must consider that before you decide to use it. If you need examples, I can provide some for you.
Good luck.
RGrossman
Participant
876 Points
228 Posts
DB2 AS400
May 18, 2006 03:34 PM|LINK
cubeberg
Member
710 Points
142 Posts
Re: DB2 AS400
May 18, 2006 04:09 PM|LINK
My Blog
RGrossman
Participant
876 Points
228 Posts
Re: DB2 AS400
May 18, 2006 05:08 PM|LINK
cubeberg
Member
710 Points
142 Posts
Re: DB2 AS400
May 18, 2006 05:25 PM|LINK
I did some searching online, and it looks like the SqlDataSource allows you to connect to an ODBC data source. I was under the impression that the SqlDataSource was specific to Sql Server, but that appears to be incorrect.
My Blog
RGrossman
Participant
876 Points
228 Posts
Re: DB2 AS400
May 18, 2006 07:04 PM|LINK
cubeberg
Member
710 Points
142 Posts
Re: DB2 AS400
May 18, 2006 07:33 PM|LINK
I found some documentation on MSDN about an OLE Db Provider for DB2, this might be a good starting point: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vsintro7/html/vxgrfinfoondatalinkpropertiesandoledbproviders.asp
I did find some information on IBM's site about integration with .NET, so you might also check out this link: http://www-128.ibm.com/developerworks/db2/library/techarticle/dm-0502alazzawe/
However, I'm not sure how that would play into the DataSource objects with .NET 2.0. There is a good chance that they would work together if IBM implements the correct interfaces.
My Blog
RGrossman
Participant
876 Points
228 Posts
Re: DB2 AS400
May 18, 2006 07:35 PM|LINK
RGrossman
Participant
876 Points
228 Posts
Re: DB2 AS400
May 22, 2006 12:01 PM|LINK
Maybe you can help me change this to work with a DSN to DB2. I use this for my inserts, updates and deletes within SQL...
<
script runat="server">Dim MyConnection As SqlConnection
Sub
Page_Load(ByVal Src As Object, ByVal E As EventArgs)myConnection =
New SqlConnection("server=10.1.0.185;" _& "database=crcwebauth;User ID=sa;Password=;")
End
SubSub
BeginSearch(sender As Object, e As System.Web.UI.ImageClickEventArgs) Dim myCommand As SqlCommandDim insertCmd As String
insertCmd = "insert into CustomerInquiry_SearchLog (CIUD, CITE, CICM, CICN, CICY, CIST, CIBG, CIDT) values ('" & sLD & "', '" & qTR & "', '" & qCM & "', '" & qCN & "', '" & qCY & "', '" & qST & "', '" & qBG & "', getdate());"
myCommand = New SqlCommand(insertCmd, myConnection)
myCommand.Connection.Open()
myCommand.ExecuteNonQuery()
myCommand.Connection.Close()
End
Sub </script>RGrossman
Participant
876 Points
228 Posts
Re: DB2 AS400
May 22, 2006 12:02 PM|LINK
I have this defined that reads perfectly from the AS400.
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString1 %>" ProviderName="<%$ ConnectionStrings:ConnectionString1.ProviderName %>" SelectCommand='SELECT "PSTERR", "PSREGR", "PSPOSN", "PSPOSD", "PSACT#" AS column1, "PSACTN", "PSTYPE", "PSBRCH", "PSDSTR", "PSCNTY", "PSCITY", "PSSTAT", "PSZIP", "PSYEAR", "PSJANS", "PSFEBS", "PSMARS", "PSAPRS", "PSMAYS", "PSJUNS", "PSJULS", "PSAUGS", "PSSEPS", "PSOCTS", "PSNOVS", "PSDECS", "PSQTR1", "PSQTR2", "PSQTR3", "PSQTR4", "PSYTDT", "PSCYTD" FROM "SLS027P"'> </asp:SqlDataSource>myow
Member
10 Points
2 Posts
Re: DB2 AS400
May 23, 2006 07:13 PM|LINK