| Author |
Message |
James Pemberton
Guest
|
Posted:
Wed Feb 09, 2005 2:22 am Post subject:
VB.Net MsDB2Connection String |
|
|
I just installed HIS 2004 server and am trying to setup a vb.net connection
string to access an AS/400. Has anyone done this and actually had it work.
I copied the connection string I set up and test in the Data Access Tool,
but to no avail. It either doesn't like my connection string or tell me the
udl is invalid if I try to use it directly.
Thanks in advance for any help |
|
| Back to top |
|
 |
Aaron Grady [MSFT]
Guest
|
Posted:
Thu Feb 10, 2005 12:12 am Post subject:
Re: VB.Net MsDB2Connection String |
|
|
James-
You can use the wizards in the data access tool to create a data source and to test the connection. Does the test connection work inside the Data Access Tool. If it does, then just diplay the connection string in the Data access tool and copy it into your program. Here's an example of a webservice using the MsDb2Client in VB.NET:
<WebMethod()> _
Public Function GetDb2Data(ByVal UserID As String, ByVal Password As String, ByVal SQLString As String) As DataSet
Dim ConnString As String
ConnString = "Provider=DB2OLEDB;Initial Catalog=CONDOR;Network Transport Library=TCP;Host CCSID=37;PC Code Page=1252;Network Address=condor;Network Port=446;Package Collection=MSPKG;Default Schema=MGB2004;Process Binary as Character=False;Units of Work=RUW;Default Qualifier=MGB2004;DBMS Platform=DB2/AS400;Persist Security Info=True;Connection Pooling=True;"
ConnString += ";User ID = " + UserID
ConnString += ";Password = " + Password
Dim myConnection As New MsDb2Connection(ConnString)
myConnection.Open()
Dim myDataAdapter As New MsDb2DataAdapter(SQLString, myConnection)
Dim myDataSet As New DataSet
myDataAdapter.Fill(myDataSet)
myConnection.Close()
Return myDataSet
End Function
HTH,
--
Aaron Grady
MCSE + Internet, MCDBA, MCSD
SNA Server/Host Integration Server 2000
Microsoft
This posting is provided "AS IS" with no warranties, and confers no rights.
Use of any included samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm
"James Pemberton" <james.pemberton@devro-casings.com> wrote in message news:uxe23vhDFHA.1280@TK2MSFTNGP10.phx.gbl...
| Quote: | I just installed HIS 2004 server and am trying to setup a vb.net connection
string to access an AS/400. Has anyone done this and actually had it work.
I copied the connection string I set up and test in the Data Access Tool,
but to no avail. It either doesn't like my connection string or tell me the
udl is invalid if I try to use it directly.
Thanks in advance for any help
|
|
|
| Back to top |
|
 |
James Pemberton
Guest
|
Posted:
Thu Feb 10, 2005 9:51 pm Post subject:
Re: VB.Net MsDB2Connection String |
|
|
I did this. I used the access tool and was able to run the sample query. I
added it to my vb.net project, and each time I receive an error. Here is a
copy of my code:
Private MsDBString As String = "Provider=DB2OLEDB;User
ID=userid;Password=password;Initial Catalog=S44CB343;Network Transport
Library=TCP;Host CCSID=65535;PC Code Page=1252;Network
Address=192.168.3.1;Network Port=446;Package Collection=USJDFMOD;Default
Schema=JPRODCOL;Process Binary as Character=True;Units of Work=RUW;DBMS
Platform=DB2/AS400;Persist Security Info=False;Connection Pooling=True;"
Private MsDBConnection As MsDb2Connection = New MsDb2Connection(MsDBString)
Private Sub MsDBConnect()
Dim selCommand As String
Dim drF41021 As MsDb2DataAdapter = New MsDb2DataAdapter(selCommand,
MsDBConnection)
Dim dsF41021 As New DataSet
MsDBConnection.Open()
selCommand = "select lilotn,lilocn,limcu, lipqoh from jprodcol.f41021 where
lilotn='" & strholdlotn & "'"
drF41021.SelectCommand.CommandText = selCommand
Try
drF41021.Fill(dsF41021)
Catch ex As MsDb2Exception
Debug.WriteLine(ex.Message)
End Try
After the execution the ex.message = SQL error occurred. SQLSTATE: HY000,
SQLCODE: -372
Any suggections?
"Aaron Grady [MSFT]" <aagrady@online.microsoft.com> wrote in message
news:um0WgLtDFHA.392@TK2MSFTNGP14.phx.gbl...
James-
You can use the wizards in the data access tool to create a data source and
to test the connection. Does the test connection work inside the Data Access
Tool. If it does, then just diplay the connection string in the Data access
tool and copy it into your program. Here's an example of a webservice using
the MsDb2Client in VB.NET:
<WebMethod()> _
Public Function GetDb2Data(ByVal UserID As String, ByVal Password As String,
ByVal SQLString As String) As DataSet
Dim ConnString As String
ConnString = "Provider=DB2OLEDB;Initial Catalog=CONDOR;Network
Transport Library=TCP;Host CCSID=37;PC Code Page=1252;Network
Address=condor;Network Port=446;Package Collection=MSPKG;Default
Schema=MGB2004;Process Binary as Character=False;Units of Work=RUW;Default
Qualifier=MGB2004;DBMS Platform=DB2/AS400;Persist Security
Info=True;Connection Pooling=True;"
ConnString += ";User ID = " + UserID
ConnString += ";Password = " + Password
Dim myConnection As New MsDb2Connection(ConnString)
myConnection.Open()
Dim myDataAdapter As New MsDb2DataAdapter(SQLString, myConnection)
Dim myDataSet As New DataSet
myDataAdapter.Fill(myDataSet)
myConnection.Close()
Return myDataSet
End Function
HTH,
--
Aaron Grady
MCSE + Internet, MCDBA, MCSD
SNA Server/Host Integration Server 2000
Microsoft
This posting is provided "AS IS" with no warranties, and confers no rights.
Use of any included samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm
"James Pemberton" <james.pemberton@devro-casings.com> wrote in message
news:uxe23vhDFHA.1280@TK2MSFTNGP10.phx.gbl...
| Quote: | I just installed HIS 2004 server and am trying to setup a vb.net
connection
string to access an AS/400. Has anyone done this and actually had it
work.
I copied the connection string I set up and test in the Data Access Tool,
but to no avail. It either doesn't like my connection string or tell me
the
udl is invalid if I try to use it directly.
Thanks in advance for any help
|
|
|
| Back to top |
|
 |
Aaron Grady [MSFT]
Guest
|
Posted:
Thu Feb 10, 2005 11:37 pm Post subject:
Re: VB.Net MsDB2Connection String |
|
|
I don't see anything particularly wrong with your code. The error you are
getting is because the Db2 provider is getting a SQLERRRM DDM message from
DB2. There must be something DB2 doesn't like about the connection string or
the query.
Here is what I would suggest:
1. Take a trace (using snatrace.exe) and then examine the trace to see if
you can figure out if it is the connection that is causing the error to
return or the execution of the query.
2. If it is the query which is causing the error, see if you can execute
that same exact query through another tool or on the AS/400 itself (using
STRSQL)
3. Check the host side logs for information about the problem. The error the
host is returning is fairly generic, but the host side logs may contain
details about what the host doesn't like.
4. Capture a Network Monitor trace and examine the DDM to see if it contains
any more clues about the failure.
If you need help with any of these steps I would suggest that you may want
to open a support case with us so that one of our support engineers can help
you.
HTH,
--
Aaron Grady
MCSE + Internet, MCDBA, MCSD
SNA Server/Host Integration Server 2000
Microsoft
This posting is provided "AS IS" with no warranties, and confers no rights.
Use of any included samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm
"James Pemberton" <james.pemberton@devro-casings.com> wrote in message
news:%237JQUh4DFHA.1040@TK2MSFTNGP09.phx.gbl...
| Quote: | I did this. I used the access tool and was able to run the sample query.
I
added it to my vb.net project, and each time I receive an error. Here is
a
copy of my code:
Private MsDBString As String = "Provider=DB2OLEDB;User
ID=userid;Password=password;Initial Catalog=S44CB343;Network Transport
Library=TCP;Host CCSID=65535;PC Code Page=1252;Network
Address=192.168.3.1;Network Port=446;Package Collection=USJDFMOD;Default
Schema=JPRODCOL;Process Binary as Character=True;Units of Work=RUW;DBMS
Platform=DB2/AS400;Persist Security Info=False;Connection Pooling=True;"
Private MsDBConnection As MsDb2Connection = New
MsDb2Connection(MsDBString)
Private Sub MsDBConnect()
Dim selCommand As String
Dim drF41021 As MsDb2DataAdapter = New MsDb2DataAdapter(selCommand,
MsDBConnection)
Dim dsF41021 As New DataSet
MsDBConnection.Open()
selCommand = "select lilotn,lilocn,limcu, lipqoh from jprodcol.f41021
where
lilotn='" & strholdlotn & "'"
drF41021.SelectCommand.CommandText = selCommand
Try
drF41021.Fill(dsF41021)
Catch ex As MsDb2Exception
Debug.WriteLine(ex.Message)
End Try
After the execution the ex.message = SQL error occurred. SQLSTATE: HY000,
SQLCODE: -372
Any suggections?
"Aaron Grady [MSFT]" <aagrady@online.microsoft.com> wrote in message
news:um0WgLtDFHA.392@TK2MSFTNGP14.phx.gbl...
James-
You can use the wizards in the data access tool to create a data source
and
to test the connection. Does the test connection work inside the Data
Access
Tool. If it does, then just diplay the connection string in the Data
access
tool and copy it into your program. Here's an example of a webservice
using
the MsDb2Client in VB.NET:
WebMethod()> _
Public Function GetDb2Data(ByVal UserID As String, ByVal Password As
String,
ByVal SQLString As String) As DataSet
Dim ConnString As String
ConnString = "Provider=DB2OLEDB;Initial Catalog=CONDOR;Network
Transport Library=TCP;Host CCSID=37;PC Code Page=1252;Network
Address=condor;Network Port=446;Package Collection=MSPKG;Default
Schema=MGB2004;Process Binary as Character=False;Units of Work=RUW;Default
Qualifier=MGB2004;DBMS Platform=DB2/AS400;Persist Security
Info=True;Connection Pooling=True;"
ConnString += ";User ID = " + UserID
ConnString += ";Password = " + Password
Dim myConnection As New MsDb2Connection(ConnString)
myConnection.Open()
Dim myDataAdapter As New MsDb2DataAdapter(SQLString, myConnection)
Dim myDataSet As New DataSet
myDataAdapter.Fill(myDataSet)
myConnection.Close()
Return myDataSet
End Function
HTH,
--
Aaron Grady
MCSE + Internet, MCDBA, MCSD
SNA Server/Host Integration Server 2000
Microsoft
This posting is provided "AS IS" with no warranties, and confers no
rights.
Use of any included samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm
"James Pemberton" <james.pemberton@devro-casings.com> wrote in message
news:uxe23vhDFHA.1280@TK2MSFTNGP10.phx.gbl...
I just installed HIS 2004 server and am trying to setup a vb.net
connection
string to access an AS/400. Has anyone done this and actually had it
work.
I copied the connection string I set up and test in the Data Access
Tool,
but to no avail. It either doesn't like my connection string or tell me
the
udl is invalid if I try to use it directly.
Thanks in advance for any help
|
|
|
| Back to top |
|
 |
Luis Esteban Valencia
Guest
|
Posted:
Fri Feb 25, 2005 7:14 pm Post subject:
Re: VB.Net MsDB2Connection String |
|
|
Hello. Could u solve the problem?
--
LUIS ESTEBAN VALENCIA
MICROSOFT DCE 3.
MIEMBRO ACTIVO DE ALIANZADEV
http://spaces.msn.com/members/extremed/
"Aaron Grady [MSFT]" <aagrady@online.microsoft.com> escribió en el mensaje
news:OEAhEd5DFHA.1188@tk2msftngp13.phx.gbl...
| Quote: | I don't see anything particularly wrong with your code. The error you are
getting is because the Db2 provider is getting a SQLERRRM DDM message from
DB2. There must be something DB2 doesn't like about the connection string
or
the query.
Here is what I would suggest:
1. Take a trace (using snatrace.exe) and then examine the trace to see if
you can figure out if it is the connection that is causing the error to
return or the execution of the query.
2. If it is the query which is causing the error, see if you can execute
that same exact query through another tool or on the AS/400 itself (using
STRSQL)
3. Check the host side logs for information about the problem. The error
the
host is returning is fairly generic, but the host side logs may contain
details about what the host doesn't like.
4. Capture a Network Monitor trace and examine the DDM to see if it
contains
any more clues about the failure.
If you need help with any of these steps I would suggest that you may want
to open a support case with us so that one of our support engineers can
help
you.
HTH,
--
Aaron Grady
MCSE + Internet, MCDBA, MCSD
SNA Server/Host Integration Server 2000
Microsoft
This posting is provided "AS IS" with no warranties, and confers no
rights.
Use of any included samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm
"James Pemberton" <james.pemberton@devro-casings.com> wrote in message
news:%237JQUh4DFHA.1040@TK2MSFTNGP09.phx.gbl...
I did this. I used the access tool and was able to run the sample
query.
I
added it to my vb.net project, and each time I receive an error. Here
is
a
copy of my code:
Private MsDBString As String = "Provider=DB2OLEDB;User
ID=userid;Password=password;Initial Catalog=S44CB343;Network Transport
Library=TCP;Host CCSID=65535;PC Code Page=1252;Network
Address=192.168.3.1;Network Port=446;Package Collection=USJDFMOD;Default
Schema=JPRODCOL;Process Binary as Character=True;Units of Work=RUW;DBMS
Platform=DB2/AS400;Persist Security Info=False;Connection Pooling=True;"
Private MsDBConnection As MsDb2Connection = New
MsDb2Connection(MsDBString)
Private Sub MsDBConnect()
Dim selCommand As String
Dim drF41021 As MsDb2DataAdapter = New MsDb2DataAdapter(selCommand,
MsDBConnection)
Dim dsF41021 As New DataSet
MsDBConnection.Open()
selCommand = "select lilotn,lilocn,limcu, lipqoh from jprodcol.f41021
where
lilotn='" & strholdlotn & "'"
drF41021.SelectCommand.CommandText = selCommand
Try
drF41021.Fill(dsF41021)
Catch ex As MsDb2Exception
Debug.WriteLine(ex.Message)
End Try
After the execution the ex.message = SQL error occurred. SQLSTATE:
HY000,
SQLCODE: -372
Any suggections?
"Aaron Grady [MSFT]" <aagrady@online.microsoft.com> wrote in message
news:um0WgLtDFHA.392@TK2MSFTNGP14.phx.gbl...
James-
You can use the wizards in the data access tool to create a data source
and
to test the connection. Does the test connection work inside the Data
Access
Tool. If it does, then just diplay the connection string in the Data
access
tool and copy it into your program. Here's an example of a webservice
using
the MsDb2Client in VB.NET:
WebMethod()> _
Public Function GetDb2Data(ByVal UserID As String, ByVal Password As
String,
ByVal SQLString As String) As DataSet
Dim ConnString As String
ConnString = "Provider=DB2OLEDB;Initial Catalog=CONDOR;Network
Transport Library=TCP;Host CCSID=37;PC Code Page=1252;Network
Address=condor;Network Port=446;Package Collection=MSPKG;Default
Schema=MGB2004;Process Binary as Character=False;Units of
Work=RUW;Default
Qualifier=MGB2004;DBMS Platform=DB2/AS400;Persist Security
Info=True;Connection Pooling=True;"
ConnString += ";User ID = " + UserID
ConnString += ";Password = " + Password
Dim myConnection As New MsDb2Connection(ConnString)
myConnection.Open()
Dim myDataAdapter As New MsDb2DataAdapter(SQLString,
myConnection)
Dim myDataSet As New DataSet
myDataAdapter.Fill(myDataSet)
myConnection.Close()
Return myDataSet
End Function
HTH,
--
Aaron Grady
MCSE + Internet, MCDBA, MCSD
SNA Server/Host Integration Server 2000
Microsoft
This posting is provided "AS IS" with no warranties, and confers no
rights.
Use of any included samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm
"James Pemberton" <james.pemberton@devro-casings.com> wrote in message
news:uxe23vhDFHA.1280@TK2MSFTNGP10.phx.gbl...
I just installed HIS 2004 server and am trying to setup a vb.net
connection
string to access an AS/400. Has anyone done this and actually had it
work.
I copied the connection string I set up and test in the Data Access
Tool,
but to no avail. It either doesn't like my connection string or tell
me
the
udl is invalid if I try to use it directly.
Thanks in advance for any help
|
|
|
| Back to top |
|
 |
|
|
|
|