Hello,
we have data sitting on AS400 (V4R5M0) - DB2-400. I need to access
that from my vb.net application. I don't know anything about AS400.
Is it possible to get data from tables and stored procedures?
can somebody give me the code which shows how to do that?
Thanks 13 7940
Hi Sehboo,
This was in this newsgroup, just search for AS400 then you see a greath
answer from Jay B. at Scott Johnson,
This is a link he provided in this message http://www.sqlthing.com/Resources/St...StopDebug.html
I hope this helps,
Cor we have data sitting on AS400 (V4R5M0) - DB2-400. I need to access that from my vb.net application. I don't know anything about AS400. Is it possible to get data from tables and stored procedures?
can somebody give me the code which shows how to do that?
Thanks
Thanks Cor,
I also saw that...but my problem is that I don't even know how to
define the DSN for AS400. Like in that code they have the following
line
CON1.Open "DSN=MYAS400;UID=HARNER;PWD=SECRET;"
I don't know how to create the AS400 DSN. When I try to create
datasources for it...I don't see any AS400 driver.
Where can I get the driver from? is it free? What about Ritmo driver
(some third party driver)...that is very expensive(around 4000
dollars). we can't spend that much money.
thanks
"Cor" <no*@non.com> wrote in message news:<#w**************@TK2MSFTNGP11.phx.gbl>... Hi Sehboo,
This was in this newsgroup, just search for AS400 then you see a greath answer from Jay B. at Scott Johnson,
This is a link he provided in this message
http://www.sqlthing.com/Resources/St...StopDebug.html
I hope this helps,
Cor we have data sitting on AS400 (V4R5M0) - DB2-400. I need to access that from my vb.net application. I don't know anything about AS400. Is it possible to get data from tables and stored procedures?
can somebody give me the code which shows how to do that?
Thanks
Sehboo,
"DSN=MYAS400" is telling you that it is using standard ODBC connection to
access the AS/400.
You need to use the ODBC Data Sources under Control panel to define the
MYAS400 "data source", you will need to select the IBM Client Access driver.
Its best to be on Client Access V5R2 or later (with current all PTFs) to be
fully supported from .NET. (I understand that you can remain on OS/400 V4R5,
its the client that needs to be current). http://www-1.ibm.com/servers/eserver...edb/index.html http://www-912.ibm.com/n_dir/nas4apa...ight=2,ii13341
The above links are from June 3rd, not sure if there are more current
versions with better support...
If you look around the SQL Thing site and the above sites you should come
across a number of samples and further information.
Hope this helps
Jay
"Sehboo" <ma*********@hotmail.com> wrote in message
news:7b**************************@posting.google.c om... Thanks Cor,
I also saw that...but my problem is that I don't even know how to define the DSN for AS400. Like in that code they have the following line
CON1.Open "DSN=MYAS400;UID=HARNER;PWD=SECRET;"
I don't know how to create the AS400 DSN. When I try to create datasources for it...I don't see any AS400 driver.
Where can I get the driver from? is it free? What about Ritmo driver (some third party driver)...that is very expensive(around 4000 dollars). we can't spend that much money.
thanks
"Cor" <no*@non.com> wrote in message
news:<#w**************@TK2MSFTNGP11.phx.gbl>... Hi Sehboo,
This was in this newsgroup, just search for AS400 then you see a greath answer from Jay B. at Scott Johnson,
This is a link he provided in this message
http://www.sqlthing.com/Resources/St...StopDebug.html
I hope this helps,
Cor we have data sitting on AS400 (V4R5M0) - DB2-400. I need to access that from my vb.net application. I don't know anything about AS400. Is it possible to get data from tables and stored procedures?
can somebody give me the code which shows how to do that?
Thanks
StarQuest has a driver for DB2 ( www.starquest.com), I believe it's
much cheaper than Ritmo.
Bob ma*********@hotmail.com (Sehboo) wrote in message news:<7b**************************@posting.google. com>... Thanks Cor,
I also saw that...but my problem is that I don't even know how to define the DSN for AS400. Like in that code they have the following line
CON1.Open "DSN=MYAS400;UID=HARNER;PWD=SECRET;"
I don't know how to create the AS400 DSN. When I try to create datasources for it...I don't see any AS400 driver.
Where can I get the driver from? is it free? What about Ritmo driver (some third party driver)...that is very expensive(around 4000 dollars). we can't spend that much money.
thanks
"Cor" <no*@non.com> wrote in message news:<#w**************@TK2MSFTNGP11.phx.gbl>... Hi Sehboo,
This was in this newsgroup, just search for AS400 then you see a greath answer from Jay B. at Scott Johnson,
This is a link he provided in this message
http://www.sqlthing.com/Resources/St...StopDebug.html
I hope this helps,
Cor we have data sitting on AS400 (V4R5M0) - DB2-400. I need to access that from my vb.net application. I don't know anything about AS400. Is it possible to get data from tables and stored procedures?
can somebody give me the code which shows how to do that?
Thanks
Another approach you can take and also to avoid using an ODBC driver
is to use the IBMDA400 OLE DB provider for .NET. This is probably the
fastest and best method to retrieve data from the AS/400 when using
..NET including record level access (RLA), SQL and stored procedures
(SQL), data queues (DQ), and commands and programs (CMD/PGM). The
following IBM Informational APAR has more details on this driver for
..NET: http://www-912.ibm.com/n_dir/nas4apa...7?OpenDocument
Thanks,
Adiel
adiel, This is probably the fastest and best method to retrieve data from the AS/400 when using
I disagree that the OLE DB is the fastest & "best" method to retrieve data
from an AS/400. I have however only used the OLE DB driver with the AS/400
from .NET. From VB6 I have used both.
Howard Arner (from SQL Thing) has documented on different occasions where
the client access ODBC driver out performs the OLE DB provider, granted this
was with ADO, however I would not expect the performance numbers to change
(much) for ADO.NET. Unfortunately I cannot find the links right now.
Whether it is better is subjective, if you are primarily using SQL & stored
procedures, in my experience ODBC tends to be better then OLE DB. If you are
using RLA, which I advise against then the OLE DB driver is better. I
recommend using stored procedures to access AS/400 data as you have more
performance & security controls that RLA or straight SQL.
IMHO: The fastest & best method has not been released yet, the fastest &
best method would be a native AS/400 client for .NET ala the OracleClient &
the SqlClient. (I'm not even sure that one is being planned).
Independent of which driver you choose, I strongly recommend you use the
CURRENT driver complete with PTFs!
I do not know if Howard has done any performance tests on the V5R2 ODBC &
OLE DB drivers under .NET yet or not.
BTW: You do realize that he link you gave is the same document that I gave,
just a different URL, they are both APAR II13341! :-)
Hope this helps
Jay
"adiel" <ad*****@hotmail.com> wrote in message
news:fe**************************@posting.google.c om... Another approach you can take and also to avoid using an ODBC driver is to use the IBMDA400 OLE DB provider for .NET. This is probably the fastest and best method to retrieve data from the AS/400 when using .NET including record level access (RLA), SQL and stored procedures (SQL), data queues (DQ), and commands and programs (CMD/PGM). The following IBM Informational APAR has more details on this driver for .NET:
http://www-912.ibm.com/n_dir/nas4apa...7?OpenDocument Thanks, Adiel
Thanks Jay,
I don't have IBM Client Access driver installed on my machine. How
can I get it? Again, is it free?
Thanks
"Jay B. Harlow [MVP - Outlook]" <Ja************@msn.com> wrote in message news:<uP**************@TK2MSFTNGP10.phx.gbl>... Sehboo, "DSN=MYAS400" is telling you that it is using standard ODBC connection to access the AS/400.
You need to use the ODBC Data Sources under Control panel to define the MYAS400 "data source", you will need to select the IBM Client Access driver.
Its best to be on Client Access V5R2 or later (with current all PTFs) to be fully supported from .NET. (I understand that you can remain on OS/400 V4R5, its the client that needs to be current).
http://www-1.ibm.com/servers/eserver...edb/index.html
http://www-912.ibm.com/n_dir/nas4apa...ight=2,ii13341
The above links are from June 3rd, not sure if there are more current versions with better support...
If you look around the SQL Thing site and the above sites you should come across a number of samples and further information.
Hope this helps Jay
"Sehboo" <ma*********@hotmail.com> wrote in message news:7b**************************@posting.google.c om... Thanks Cor,
I also saw that...but my problem is that I don't even know how to define the DSN for AS400. Like in that code they have the following line
CON1.Open "DSN=MYAS400;UID=HARNER;PWD=SECRET;"
I don't know how to create the AS400 DSN. When I try to create datasources for it...I don't see any AS400 driver.
Where can I get the driver from? is it free? What about Ritmo driver (some third party driver)...that is very expensive(around 4000 dollars). we can't spend that much money.
thanks
"Cor" <no*@non.com> wrote in message news:<#w**************@TK2MSFTNGP11.phx.gbl>... Hi Sehboo,
This was in this newsgroup, just search for AS400 then you see a greath answer from Jay B. at Scott Johnson,
This is a link he provided in this message
http://www.sqlthing.com/Resources/St...StopDebug.html
I hope this helps,
Cor > > we have data sitting on AS400 (V4R5M0) - DB2-400. I need to access > that from my vb.net application. I don't know anything about AS400. > Is it possible to get data from tables and stored procedures? > > can somebody give me the code which shows how to do that? > > Thanks
Alright,
Here is the code that I have (i got it from one of these newsgroups
and then changed it). I am calling a stored procedure on AS400. This
SP takes 5 parameters.
It seems like I can open the connection but when It blows up at
objCommand.ExecuteNonQuery() method call. The exception that I get is
"ERROR [HY000][IBM][Client Access Express ODBC Driver(32-bit)][DB2/400
SQL]SQL0301 - Input host variable
I have no idea what that means.
By they way I have already made sure that Stored procedure is there.
Can anybody help?
Thanks
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button3.Click
Dim objConnection As New
OdbcConnection("DSN=AS400Connection;UID=myuid;PWD= mypwd")
Dim objCommand As New OdbcCommand("{ Call DS101SP1(?, ?, ?, ?,
?) }", objConnection)
Dim objParameter1 As New OdbcParameter
With objParameter1
.ParameterName = "MyParm1"
.DbType = DbType.AnsiString
.Direction = ParameterDirection.InputOutput
.Size = 6
.Value = "147031"
End With
objCommand.Parameters.Add(objParameter1)
Dim objParameter2 As New OdbcParameter
With objParameter2
.ParameterName = "MyParm2"
.DbType = DbType.AnsiString
.Direction = ParameterDirection.InputOutput
.Size = 4
.Value = "8487"
End With
objCommand.Parameters.Add(objParameter2)
Dim objParameter3 As New OdbcParameter
With objParameter3
.ParameterName = "MyParm3"
.DbType = DbType.AnsiString
.Direction = ParameterDirection.InputOutput
.Size = 1
.Value = "1"
End With
objCommand.Parameters.Add(objParameter3)
Dim objParameter4 As New OdbcParameter
With objParameter4
.ParameterName = "MyParm4"
.DbType = DbType.AnsiString
.Direction = ParameterDirection.InputOutput
.Size = 1
.Value = "A"
End With
objCommand.Parameters.Add(objParameter4)
Dim objParameter5 As New OdbcParameter
With objParameter5
.ParameterName = "MyParm5"
.DbType = DbType.AnsiString
.Direction = ParameterDirection.InputOutput
.Size = 1
.Value = "B"
End With
objCommand.Parameters.Add(objParameter5)
objCommand.CommandType = CommandType.StoredProcedure
objConnection.Open()
Try
objCommand.ExecuteNonQuery()
Catch ex As Exception
MsgBox(ex.Message)
End Try
objConnection = Nothing
objCommand = Nothing
objParameter1 = Nothing
objParameter2 = Nothing
objParameter3 = Nothing
objParameter4 = Nothing
objParameter5 = Nothing
End Sub db*****@hotmail.com (DB2) wrote in message news:<a7*************************@posting.google.c om>... StarQuest has a driver for DB2 (www.starquest.com), I believe it's much cheaper than Ritmo.
Bob
ma*********@hotmail.com (Sehboo) wrote in message news:<7b**************************@posting.google. com>... Thanks Cor,
I also saw that...but my problem is that I don't even know how to define the DSN for AS400. Like in that code they have the following line
CON1.Open "DSN=MYAS400;UID=HARNER;PWD=SECRET;"
I don't know how to create the AS400 DSN. When I try to create datasources for it...I don't see any AS400 driver.
Where can I get the driver from? is it free? What about Ritmo driver (some third party driver)...that is very expensive(around 4000 dollars). we can't spend that much money.
thanks
"Cor" <no*@non.com> wrote in message news:<#w**************@TK2MSFTNGP11.phx.gbl>... Hi Sehboo,
This was in this newsgroup, just search for AS400 then you see a greath answer from Jay B. at Scott Johnson,
This is a link he provided in this message
http://www.sqlthing.com/Resources/St...StopDebug.html
I hope this helps,
Cor > > we have data sitting on AS400 (V4R5M0) - DB2-400. I need to access > that from my vb.net application. I don't know anything about AS400. > Is it possible to get data from tables and stored procedures? > > can somebody give me the code which shows how to do that? > > Thanks
Sehboo,
It is installed when you install Client Access (iSeries Access) Express on
your machine.
Hope this helps
Jay
"Sehboo" <ma*********@hotmail.com> wrote in message
news:7b*************************@posting.google.co m... Thanks Jay,
I don't have IBM Client Access driver installed on my machine. How can I get it? Again, is it free?
Thanks
"Jay B. Harlow [MVP - Outlook]" <Ja************@msn.com> wrote in message
news:<uP**************@TK2MSFTNGP10.phx.gbl>... Sehboo, "DSN=MYAS400" is telling you that it is using standard ODBC connection
to access the AS/400.
You need to use the ODBC Data Sources under Control panel to define the MYAS400 "data source", you will need to select the IBM Client Access
driver. Its best to be on Client Access V5R2 or later (with current all PTFs) to
be fully supported from .NET. (I understand that you can remain on OS/400
V4R5, its the client that needs to be current).
http://www-1.ibm.com/servers/eserver...edb/index.html
http://www-912.ibm.com/n_dir/nas4apa...ight=2,ii13341 The above links are from June 3rd, not sure if there are more current versions with better support...
If you look around the SQL Thing site and the above sites you should
come across a number of samples and further information.
Hope this helps Jay
"Sehboo" <ma*********@hotmail.com> wrote in message news:7b**************************@posting.google.c om... Thanks Cor,
I also saw that...but my problem is that I don't even know how to define the DSN for AS400. Like in that code they have the following line
CON1.Open "DSN=MYAS400;UID=HARNER;PWD=SECRET;"
I don't know how to create the AS400 DSN. When I try to create datasources for it...I don't see any AS400 driver.
Where can I get the driver from? is it free? What about Ritmo driver (some third party driver)...that is very expensive(around 4000 dollars). we can't spend that much money.
thanks
"Cor" <no*@non.com> wrote in message news:<#w**************@TK2MSFTNGP11.phx.gbl>... > Hi Sehboo, > > This was in this newsgroup, just search for AS400 then you see a
greath > answer from Jay B. at Scott Johnson, > > This is a link he provided in this message > > http://www.sqlthing.com/Resources/St...StopDebug.html > > I hope this helps, > > Cor > > > > we have data sitting on AS400 (V4R5M0) - DB2-400. I need to
access > > that from my vb.net application. I don't know anything about
AS400. > > Is it possible to get data from tables and stored procedures? > > > > can somebody give me the code which shows how to do that? > > > > Thanks
Sehboo,
I suspect your parameter definitions in your VB.NET code does not match the
parameters expected by your stored procedure. Reviewing the info at both
links I gave you should find the technical documentation on the driver with
samples, they will be in VB6 & VBA, however the concepts are the same in
VB.NET & ADO.NET.
Unfortunately I do not have any real good resources to help you track down
the problem. What you can (try) to do is to find the job log on the AS/400
for the job that handled the request, there should be messages in it that
will help identify the actual problem.
Hope this helps
Jay
"Sehboo" <ma*********@hotmail.com> wrote in message
news:7b**************************@posting.google.c om... Alright,
Here is the code that I have (i got it from one of these newsgroups and then changed it). I am calling a stored procedure on AS400. This SP takes 5 parameters.
It seems like I can open the connection but when It blows up at objCommand.ExecuteNonQuery() method call. The exception that I get is "ERROR [HY000][IBM][Client Access Express ODBC Driver(32-bit)][DB2/400 SQL]SQL0301 - Input host variable
I have no idea what that means.
By they way I have already made sure that Stored procedure is there.
Can anybody help?
Thanks
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click Dim objConnection As New OdbcConnection("DSN=AS400Connection;UID=myuid;PWD= mypwd") Dim objCommand As New OdbcCommand("{ Call DS101SP1(?, ?, ?, ?, ?) }", objConnection) Dim objParameter1 As New OdbcParameter
With objParameter1 .ParameterName = "MyParm1" .DbType = DbType.AnsiString .Direction = ParameterDirection.InputOutput .Size = 6 .Value = "147031" End With objCommand.Parameters.Add(objParameter1)
Dim objParameter2 As New OdbcParameter
With objParameter2 .ParameterName = "MyParm2" .DbType = DbType.AnsiString .Direction = ParameterDirection.InputOutput .Size = 4 .Value = "8487" End With objCommand.Parameters.Add(objParameter2)
Dim objParameter3 As New OdbcParameter
With objParameter3 .ParameterName = "MyParm3" .DbType = DbType.AnsiString .Direction = ParameterDirection.InputOutput .Size = 1 .Value = "1" End With objCommand.Parameters.Add(objParameter3)
Dim objParameter4 As New OdbcParameter
With objParameter4 .ParameterName = "MyParm4" .DbType = DbType.AnsiString .Direction = ParameterDirection.InputOutput .Size = 1 .Value = "A" End With objCommand.Parameters.Add(objParameter4)
Dim objParameter5 As New OdbcParameter
With objParameter5 .ParameterName = "MyParm5" .DbType = DbType.AnsiString .Direction = ParameterDirection.InputOutput .Size = 1 .Value = "B" End With objCommand.Parameters.Add(objParameter5)
objCommand.CommandType = CommandType.StoredProcedure objConnection.Open() Try objCommand.ExecuteNonQuery() Catch ex As Exception MsgBox(ex.Message) End Try
objConnection = Nothing objCommand = Nothing objParameter1 = Nothing objParameter2 = Nothing objParameter3 = Nothing objParameter4 = Nothing objParameter5 = Nothing
End Sub db*****@hotmail.com (DB2) wrote in message
news:<a7*************************@posting.google.c om>... StarQuest has a driver for DB2 (www.starquest.com), I believe it's much cheaper than Ritmo.
Bob
ma*********@hotmail.com (Sehboo) wrote in message
news:<7b**************************@posting.google. com>... Thanks Cor,
I also saw that...but my problem is that I don't even know how to define the DSN for AS400. Like in that code they have the following line
CON1.Open "DSN=MYAS400;UID=HARNER;PWD=SECRET;"
I don't know how to create the AS400 DSN. When I try to create datasources for it...I don't see any AS400 driver.
Where can I get the driver from? is it free? What about Ritmo driver (some third party driver)...that is very expensive(around 4000 dollars). we can't spend that much money.
thanks
"Cor" <no*@non.com> wrote in message
news:<#w**************@TK2MSFTNGP11.phx.gbl>... > Hi Sehboo, > > This was in this newsgroup, just search for AS400 then you see a
greath > answer from Jay B. at Scott Johnson, > > This is a link he provided in this message > > http://www.sqlthing.com/Resources/St...StopDebug.html > > I hope this helps, > > Cor > > > > we have data sitting on AS400 (V4R5M0) - DB2-400. I need to
access > > that from my vb.net application. I don't know anything about
AS400. > > Is it possible to get data from tables and stored procedures? > > > > can somebody give me the code which shows how to do that? > > > > Thanks
Thanks Jay,
You were right...there was a problem with the parameters...
Now, I see one more problem....and I hope that somebody can show me
the path to fix that...
I have a stored procedure on AS400 which returns a record set. I can
call the stored procedure but I just never see the records. Number of
returned rows is always 0 eventhough I know it returns more then 1
more.
Here is my code:
Dim dbDataAdapter As New OdbcDataAdapter(objCommand)
Dim i As Integer = dbDataAdapter.Fill(mdbDataset)
Dim aa As String = mdbDataset.GetXml()
If (mdbDataset.Tables.Count > 0) Then
miRecordCount = mdbDataset.Tables(0).Rows.Count
mdbRow = mdbDataset.Tables(0).Rows(0)
miFieldCount = mdbRow.Table.Columns.Count
End If
for some reason, miRecordCount is always 0.
Why?
Thanks
"Jay B. Harlow [MVP - Outlook]" <Ja************@msn.com> wrote in message news:<Og**************@TK2MSFTNGP11.phx.gbl>... Sehboo, I suspect your parameter definitions in your VB.NET code does not match the parameters expected by your stored procedure. Reviewing the info at both links I gave you should find the technical documentation on the driver with samples, they will be in VB6 & VBA, however the concepts are the same in VB.NET & ADO.NET.
Unfortunately I do not have any real good resources to help you track down the problem. What you can (try) to do is to find the job log on the AS/400 for the job that handled the request, there should be messages in it that will help identify the actual problem.
Hope this helps Jay
"Sehboo" <ma*********@hotmail.com> wrote in message news:7b**************************@posting.google.c om... Alright,
Here is the code that I have (i got it from one of these newsgroups and then changed it). I am calling a stored procedure on AS400. This SP takes 5 parameters.
It seems like I can open the connection but when It blows up at objCommand.ExecuteNonQuery() method call. The exception that I get is "ERROR [HY000][IBM][Client Access Express ODBC Driver(32-bit)][DB2/400 SQL]SQL0301 - Input host variable
I have no idea what that means.
By they way I have already made sure that Stored procedure is there.
Can anybody help?
Thanks
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click Dim objConnection As New OdbcConnection("DSN=AS400Connection;UID=myuid;PWD= mypwd") Dim objCommand As New OdbcCommand("{ Call DS101SP1(?, ?, ?, ?, ?) }", objConnection) Dim objParameter1 As New OdbcParameter
With objParameter1 .ParameterName = "MyParm1" .DbType = DbType.AnsiString .Direction = ParameterDirection.InputOutput .Size = 6 .Value = "147031" End With objCommand.Parameters.Add(objParameter1)
Dim objParameter2 As New OdbcParameter
With objParameter2 .ParameterName = "MyParm2" .DbType = DbType.AnsiString .Direction = ParameterDirection.InputOutput .Size = 4 .Value = "8487" End With objCommand.Parameters.Add(objParameter2)
Dim objParameter3 As New OdbcParameter
With objParameter3 .ParameterName = "MyParm3" .DbType = DbType.AnsiString .Direction = ParameterDirection.InputOutput .Size = 1 .Value = "1" End With objCommand.Parameters.Add(objParameter3)
Dim objParameter4 As New OdbcParameter
With objParameter4 .ParameterName = "MyParm4" .DbType = DbType.AnsiString .Direction = ParameterDirection.InputOutput .Size = 1 .Value = "A" End With objCommand.Parameters.Add(objParameter4)
Dim objParameter5 As New OdbcParameter
With objParameter5 .ParameterName = "MyParm5" .DbType = DbType.AnsiString .Direction = ParameterDirection.InputOutput .Size = 1 .Value = "B" End With objCommand.Parameters.Add(objParameter5)
objCommand.CommandType = CommandType.StoredProcedure objConnection.Open() Try objCommand.ExecuteNonQuery() Catch ex As Exception MsgBox(ex.Message) End Try
objConnection = Nothing objCommand = Nothing objParameter1 = Nothing objParameter2 = Nothing objParameter3 = Nothing objParameter4 = Nothing objParameter5 = Nothing
End Sub db*****@hotmail.com (DB2) wrote in message news:<a7*************************@posting.google.c om>... StarQuest has a driver for DB2 (www.starquest.com), I believe it's much cheaper than Ritmo.
Bob
ma*********@hotmail.com (Sehboo) wrote in message news:<7b**************************@posting.google. com>... > Thanks Cor, > > I also saw that...but my problem is that I don't even know how to > define the DSN for AS400. Like in that code they have the following > line > > CON1.Open "DSN=MYAS400;UID=HARNER;PWD=SECRET;" > > I don't know how to create the AS400 DSN. When I try to create > datasources for it...I don't see any AS400 driver. > > Where can I get the driver from? is it free? What about Ritmo driver > (some third party driver)...that is very expensive(around 4000 > dollars). we can't spend that much money. > > thanks > > > "Cor" <no*@non.com> wrote in message news:<#w**************@TK2MSFTNGP11.phx.gbl>... > > Hi Sehboo, > > > > This was in this newsgroup, just search for AS400 then you see a greath > > answer from Jay B. at Scott Johnson, > > > > This is a link he provided in this message > > > > http://www.sqlthing.com/Resources/St...StopDebug.html > > > > I hope this helps, > > > > Cor > > > > > > we have data sitting on AS400 (V4R5M0) - DB2-400. I need to access > > > that from my vb.net application. I don't know anything about AS400. > > > Is it possible to get data from tables and stored procedures? > > > > > > can somebody give me the code which shows how to do that? > > > > > > Thanks
Sehboo,
How are you defining the Stored Procedure itself?
- All SQL
- RPG or COBOL & SQL External Stored Procedure statement
- Other
The SQL part of your stored procedure needs to indicate that it is returning
result sets. Whether or not the body of the stored procedure is in SQL, RPG,
COBOL, or Java.
Hope this helps
Jay
"Sehboo" <ma*********@hotmail.com> wrote in message
news:7b*************************@posting.google.co m... Thanks Jay,
You were right...there was a problem with the parameters...
Now, I see one more problem....and I hope that somebody can show me the path to fix that...
I have a stored procedure on AS400 which returns a record set. I can call the stored procedure but I just never see the records. Number of returned rows is always 0 eventhough I know it returns more then 1 more.
Here is my code:
Dim dbDataAdapter As New OdbcDataAdapter(objCommand) Dim i As Integer = dbDataAdapter.Fill(mdbDataset) Dim aa As String = mdbDataset.GetXml() If (mdbDataset.Tables.Count > 0) Then miRecordCount = mdbDataset.Tables(0).Rows.Count mdbRow = mdbDataset.Tables(0).Rows(0) miFieldCount = mdbRow.Table.Columns.Count End If
for some reason, miRecordCount is always 0.
Why?
Thanks "Jay B. Harlow [MVP - Outlook]" <Ja************@msn.com> wrote in message
news:<Og**************@TK2MSFTNGP11.phx.gbl>... Sehboo, I suspect your parameter definitions in your VB.NET code does not match
the parameters expected by your stored procedure. Reviewing the info at both links I gave you should find the technical documentation on the driver
with samples, they will be in VB6 & VBA, however the concepts are the same in VB.NET & ADO.NET.
Unfortunately I do not have any real good resources to help you track
down the problem. What you can (try) to do is to find the job log on the
AS/400 for the job that handled the request, there should be messages in it
that will help identify the actual problem.
Hope this helps Jay
"Sehboo" <ma*********@hotmail.com> wrote in message news:7b**************************@posting.google.c om... Alright,
Here is the code that I have (i got it from one of these newsgroups and then changed it). I am calling a stored procedure on AS400. This SP takes 5 parameters.
It seems like I can open the connection but when It blows up at objCommand.ExecuteNonQuery() method call. The exception that I get is "ERROR [HY000][IBM][Client Access Express ODBC Driver(32-bit)][DB2/400 SQL]SQL0301 - Input host variable
I have no idea what that means.
By they way I have already made sure that Stored procedure is there.
Can anybody help?
Thanks
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click Dim objConnection As New OdbcConnection("DSN=AS400Connection;UID=myuid;PWD= mypwd") Dim objCommand As New OdbcCommand("{ Call DS101SP1(?, ?, ?, ?, ?) }", objConnection) Dim objParameter1 As New OdbcParameter
With objParameter1 .ParameterName = "MyParm1" .DbType = DbType.AnsiString .Direction = ParameterDirection.InputOutput .Size = 6 .Value = "147031" End With objCommand.Parameters.Add(objParameter1)
Dim objParameter2 As New OdbcParameter
With objParameter2 .ParameterName = "MyParm2" .DbType = DbType.AnsiString .Direction = ParameterDirection.InputOutput .Size = 4 .Value = "8487" End With objCommand.Parameters.Add(objParameter2)
Dim objParameter3 As New OdbcParameter
With objParameter3 .ParameterName = "MyParm3" .DbType = DbType.AnsiString .Direction = ParameterDirection.InputOutput .Size = 1 .Value = "1" End With objCommand.Parameters.Add(objParameter3)
Dim objParameter4 As New OdbcParameter
With objParameter4 .ParameterName = "MyParm4" .DbType = DbType.AnsiString .Direction = ParameterDirection.InputOutput .Size = 1 .Value = "A" End With objCommand.Parameters.Add(objParameter4)
Dim objParameter5 As New OdbcParameter
With objParameter5 .ParameterName = "MyParm5" .DbType = DbType.AnsiString .Direction = ParameterDirection.InputOutput .Size = 1 .Value = "B" End With objCommand.Parameters.Add(objParameter5)
objCommand.CommandType = CommandType.StoredProcedure objConnection.Open() Try objCommand.ExecuteNonQuery() Catch ex As Exception MsgBox(ex.Message) End Try
objConnection = Nothing objCommand = Nothing objParameter1 = Nothing objParameter2 = Nothing objParameter3 = Nothing objParameter4 = Nothing objParameter5 = Nothing
End Sub db*****@hotmail.com (DB2) wrote in message news:<a7*************************@posting.google.c om>... > StarQuest has a driver for DB2 (www.starquest.com), I believe it's > much cheaper than Ritmo. > > Bob > > ma*********@hotmail.com (Sehboo) wrote in message news:<7b**************************@posting.google. com>... > > Thanks Cor, > > > > I also saw that...but my problem is that I don't even know how to > > define the DSN for AS400. Like in that code they have the
following > > line > > > > CON1.Open "DSN=MYAS400;UID=HARNER;PWD=SECRET;" > > > > I don't know how to create the AS400 DSN. When I try to create > > datasources for it...I don't see any AS400 driver. > > > > Where can I get the driver from? is it free? What about Ritmo
driver > > (some third party driver)...that is very expensive(around 4000 > > dollars). we can't spend that much money. > > > > thanks > > > > > > "Cor" <no*@non.com> wrote in message news:<#w**************@TK2MSFTNGP11.phx.gbl>... > > > Hi Sehboo, > > > > > > This was in this newsgroup, just search for AS400 then you see a greath > > > answer from Jay B. at Scott Johnson, > > > > > > This is a link he provided in this message > > > > > > http://www.sqlthing.com/Resources/St...StopDebug.html > > > > > > I hope this helps, > > > > > > Cor > > > > > > > > we have data sitting on AS400 (V4R5M0) - DB2-400. I need to access > > > > that from my vb.net application. I don't know anything about AS400. > > > > Is it possible to get data from tables and stored procedures? > > > > > > > > can somebody give me the code which shows how to do that? > > > > > > > > Thanks
Thanks Jay - I really appreciate your help.
Stored procedure is fine because I can get the data using Ritmo
driver, but we want to use ODBC so that we won't have to buy
ritmo...it is very expensive...This means that I am missing something
on the frontend. All the examples that I see have no problem like
this.
ODBC call, doesn't throw any exception...it just never returns any
data...has anybody else done this before? our AS400 version is V4R5.
Maybe I am missing something on the DSN setting?
Also, if this works then why would anybody buy ritmo driver?
If I get this done then not just me, but my VP will appreciate it too
:-)
Thanks
"Jay B. Harlow [MVP - Outlook]" <Ja************@msn.com> wrote in message news:<Oc**************@TK2MSFTNGP11.phx.gbl>... Sehboo, How are you defining the Stored Procedure itself?
- All SQL - RPG or COBOL & SQL External Stored Procedure statement - Other
The SQL part of your stored procedure needs to indicate that it is returning result sets. Whether or not the body of the stored procedure is in SQL, RPG, COBOL, or Java.
Hope this helps Jay
"Sehboo" <ma*********@hotmail.com> wrote in message news:7b*************************@posting.google.co m... Thanks Jay,
You were right...there was a problem with the parameters...
Now, I see one more problem....and I hope that somebody can show me the path to fix that...
I have a stored procedure on AS400 which returns a record set. I can call the stored procedure but I just never see the records. Number of returned rows is always 0 eventhough I know it returns more then 1 more.
Here is my code:
Dim dbDataAdapter As New OdbcDataAdapter(objCommand) Dim i As Integer = dbDataAdapter.Fill(mdbDataset) Dim aa As String = mdbDataset.GetXml() If (mdbDataset.Tables.Count > 0) Then miRecordCount = mdbDataset.Tables(0).Rows.Count mdbRow = mdbDataset.Tables(0).Rows(0) miFieldCount = mdbRow.Table.Columns.Count End If
for some reason, miRecordCount is always 0.
Why?
Thanks "Jay B. Harlow [MVP - Outlook]" <Ja************@msn.com> wrote in message news:<Og**************@TK2MSFTNGP11.phx.gbl>... Sehboo, I suspect your parameter definitions in your VB.NET code does not match the parameters expected by your stored procedure. Reviewing the info at both links I gave you should find the technical documentation on the driver with samples, they will be in VB6 & VBA, however the concepts are the same in VB.NET & ADO.NET.
Unfortunately I do not have any real good resources to help you track down the problem. What you can (try) to do is to find the job log on the AS/400 for the job that handled the request, there should be messages in it that will help identify the actual problem.
Hope this helps Jay
"Sehboo" <ma*********@hotmail.com> wrote in message news:7b**************************@posting.google.c om... > Alright, > > Here is the code that I have (i got it from one of these newsgroups > and then changed it). I am calling a stored procedure on AS400. This > SP takes 5 parameters. > > It seems like I can open the connection but when It blows up at > objCommand.ExecuteNonQuery() method call. The exception that I get is > "ERROR [HY000][IBM][Client Access Express ODBC Driver(32-bit)][DB2/400 > SQL]SQL0301 - Input host variable > > I have no idea what that means. > > By they way I have already made sure that Stored procedure is there. > > Can anybody help? > > Thanks > > > Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As > System.EventArgs) Handles Button3.Click > Dim objConnection As New > OdbcConnection("DSN=AS400Connection;UID=myuid;PWD= mypwd") > Dim objCommand As New OdbcCommand("{ Call DS101SP1(?, ?, ?, ?, > ?) }", objConnection) > Dim objParameter1 As New OdbcParameter > > With objParameter1 > .ParameterName = "MyParm1" > .DbType = DbType.AnsiString > .Direction = ParameterDirection.InputOutput > .Size = 6 > .Value = "147031" > End With > objCommand.Parameters.Add(objParameter1) > > Dim objParameter2 As New OdbcParameter > > With objParameter2 > .ParameterName = "MyParm2" > .DbType = DbType.AnsiString > .Direction = ParameterDirection.InputOutput > .Size = 4 > .Value = "8487" > End With > objCommand.Parameters.Add(objParameter2) > > Dim objParameter3 As New OdbcParameter > > With objParameter3 > .ParameterName = "MyParm3" > .DbType = DbType.AnsiString > .Direction = ParameterDirection.InputOutput > .Size = 1 > .Value = "1" > End With > objCommand.Parameters.Add(objParameter3) > > Dim objParameter4 As New OdbcParameter > > With objParameter4 > .ParameterName = "MyParm4" > .DbType = DbType.AnsiString > .Direction = ParameterDirection.InputOutput > .Size = 1 > .Value = "A" > End With > objCommand.Parameters.Add(objParameter4) > > Dim objParameter5 As New OdbcParameter > > With objParameter5 > .ParameterName = "MyParm5" > .DbType = DbType.AnsiString > .Direction = ParameterDirection.InputOutput > .Size = 1 > .Value = "B" > End With > objCommand.Parameters.Add(objParameter5) > > > objCommand.CommandType = CommandType.StoredProcedure > objConnection.Open() > Try > objCommand.ExecuteNonQuery() > Catch ex As Exception > MsgBox(ex.Message) > End Try > > objConnection = Nothing > objCommand = Nothing > objParameter1 = Nothing > objParameter2 = Nothing > objParameter3 = Nothing > objParameter4 = Nothing > objParameter5 = Nothing > > End Sub > db*****@hotmail.com (DB2) wrote in message news:<a7*************************@posting.google.c om>... > > StarQuest has a driver for DB2 (www.starquest.com), I believe it's > > much cheaper than Ritmo. > > > > Bob > > > > ma*********@hotmail.com (Sehboo) wrote in message news:<7b**************************@posting.google. com>... > > > Thanks Cor, > > > > > > I also saw that...but my problem is that I don't even know how to > > > define the DSN for AS400. Like in that code they have the following > > > line > > > > > > CON1.Open "DSN=MYAS400;UID=HARNER;PWD=SECRET;" > > > > > > I don't know how to create the AS400 DSN. When I try to create > > > datasources for it...I don't see any AS400 driver. > > > > > > Where can I get the driver from? is it free? What about Ritmo driver > > > (some third party driver)...that is very expensive(around 4000 > > > dollars). we can't spend that much money. > > > > > > thanks > > > > > > > > > "Cor" <no*@non.com> wrote in message news:<#w**************@TK2MSFTNGP11.phx.gbl>... > > > > Hi Sehboo, > > > > > > > > This was in this newsgroup, just search for AS400 then you see a greath > > > > answer from Jay B. at Scott Johnson, > > > > > > > > This is a link he provided in this message > > > > > > > > http://www.sqlthing.com/Resources/St...StopDebug.html > > > > > > > > I hope this helps, > > > > > > > > Cor > > > > > > > > > > we have data sitting on AS400 (V4R5M0) - DB2-400. I need to access > > > > > that from my vb.net application. I don't know anything about AS400. > > > > > Is it possible to get data from tables and stored procedures? > > > > > > > > > > can somebody give me the code which shows how to do that? > > > > > > > > > > Thanks
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: fn |
last post by:
Can anyone help me understand what it takes to define a Linked Server
connection to an IBM eSeries (AS400)? Do I need Microsoft's SNA Server
or some other product or can I simply do it with the...
|
by: Niyazi |
last post by:
Hi,
Our company uses IBM AS400 and DB2 (version 4.5 I guess). I have to do some
report but I donot know how to access the AS400 DB2. I search IBM
unfortunately IBM site in mess. Can anyone tell...
|
by: Niyazi |
last post by:
Hi,
I have to retrieve a data from AS400 DB2 and after working with data I have
to export into one of existing Excel file.
I can connect into specific library in AS400 DB2 using AS400...
|
by: CompDude |
last post by:
Hi All
I am trying to copy data from DB2 to SQL server using SQL Data
Tranformation Services.
I am able to do that by supplying AS400 username/password along with
the iSeries DSN Name, at the...
|
by: alan_sec |
last post by:
Hi.
Does the com.ibm.as400.access.AS400JDBCDriver driver that is part of
JTOpen (http://jt400.sourceforge.net) works with db2 udb version 7 that
is installed on windows 2000?
I' m trying to...
|
by: Amaryllis |
last post by:
I'm trying to call a CL which is located on our AS400 from a Windows
application. I've tried to code it in different ways, but I seem to
get the same error every time. Does anyone have any clue...
|
by: MadMan2004 |
last post by:
Hello all!
I'm having a problem with a project I'm working on and I'd like to ask
for anyone's input that might be helpful. I'm building a rather large
front-end application connecting to an...
|
by: Iain |
last post by:
Hi All
I am creating a database trigger to write details real time from tables
on one AS400 to another over our WAN. Is there such a concept as ODBC
connections on the AS400 to
perform this...
|
by: accyboy1981 |
last post by:
Hi,
I'm new to AS400 and am trying to copy the contents of a table from an
SQL Server 2000 table to a table in AS400, I'm doing this using DTS.
I'm connecting using the iSeries Access ODBC...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
| |