I am trying to connect to a DB2 database in Excel 2003 using Visual Basic for Applications. When I run the program, it throws an error when the connection is attempting to open (cn.Open). I get an error saying "Run-time error '3706': Provider cannot be found. It may not be properly installed."
The thing is that I have successfully connected to the same database in a VBScript with the same connection string.
cs = "Provider=IBMDADB2;Database=DMPROD;Hostname=<hostname>.ibm.com;protocol=TCPIP;Port=3700;Uid=;pwd="
In my effort to resolve this issue, I have tried to reference each of the different versions of the Microsoft ActiveX Data Objects x.x Library in the Project and all give the same result. I have also reloaded the DB2 client on my local machine. Nothing helps.
I am looking for any ideas on how to resolve this issue.
Dim cn As ADODB.Connection
Dim rs As ADODB.Recordset
Dim cs As String
cs = "Provider=IBMDADB2;Database=DMPROD;Hostname=saildmdb.pok.ibm.com;protocol=TCPIP;Port=3700;Uid=;pwd="
Set cn = New ADODB.Connection
Set rs = New ADODB.Recordset
cn.ConnectionString = cs
cn.Open <- Fails here
Pinned topic ADODB.Connection - Provider Not Found using Visual Basic for Applications
Answered question This question has been answered.
Unanswered question This question has not been answered yet.
Updated on 2012-01-22T21:43:33Z at 2012-01-22T21:43:33Z by cansomeonehelpme
Nodlu 270002545X1 Post
Re: ADODB.Connection - Provider Not Found using Visual Basic for Applications2011-12-20T12:35:33ZThis is the accepted answer. This is the accepted answer.You could try to give the provider IBMDADB2.DB2COPY1
DB2COPY1 is the default name of the db2 client
If you have given a other name during installation of the db2 client, use your name of client instead of DB2COPY1.