Hi.

I am having connection issue while connecting to using below string
provider=IBMDADB2;Data Source=XXXX.XXXXX.COM:5000;Database=C2RCU0;Uid=s858;Pwd=cccc

Getting error like database not found. But What i found was connection to mainframes it self was not happenning. Do i need to provide any other information or what i am missing here..

sConnection As String = "provider=IBMDADB2;Data Source=XXXX.XXXXX.COM:5000;Database=C2RCU0;Uid=s858;Pwd=cccc"
Dim sql As String = "SELECT COUNT(*) FROM DB2.TEXT_PHRASE WHERE FK_CD = '00078' AND S_DT = '01/01/0001' "
Dim DB As New OleDbConnection

   1. DB.ConnectionString = sConnection
   2. Dim cmd As New OleDbCommand(sql, DB)
   3. Dim commandtype As New CommandType
   4. cmd.CommandType = commandtype.Text
   5. Dim ds As New DataSet
   6. Dim da As New OleDbDataAdapter(cmd)
   7. 'DB.Open()
   8. da.Fill(ds)
   9. Msg = ds.ToString
  10. MsgBox(Msg, MsgBoxStyle.OkOnly, APPLICATION_TITLE)

I am getting error and showing connection time out in details but exception what i am catching is database name not found

I think what you are meaning to do is.

Dim sConnection As String = "Provider=SQLOLEDB;Data Source="XXXX.XXXXX.COM:5000;Initial Catalog=IBMDADB2;Integrated Security=SSPI"

Also, you might want to remove the user name and password from your string....This is a public forum, and is open to the unregistered public.

At bare minimum, you could have a co-worker see this,identify you, and possibly lead to your termination.

Hi,

Thanks for your response. After using the 2 strings you have mentiones i a getting below error.

"Multiple-step OLE DB operation generated errors. Check each OLE DB status value, if available. No work was done."

am i missing anyting? Also in my datasource i have included port number also. Should i include it or remove?

What database type is on the mainframe?
AS400?

It is DB2 database. Not AS400

TCP/IP or APPC?

And are you using Microsoft's OleDB provider or IBM's??

I am using IBM's OleDB driver IBMDADB2. TCP/IP protocol.But there was no defined variable in Oledbconnection string to add protocl.

The string you are looking for will look like this:

Dim str As String ="Provider=IBMDADB2;Database=myDataBase;Hostname=myServerAddress;Protocol=TCPIP; Port=50000;Uid=myUsername;Pwd=myPassword;"

This string, and others like it can be found here.

I just found that my DB2CONNECT has few issues...Do we need DB2 CONNECT s/w for doing this?

That connection string should work for DB2 v7 and above

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.