Topic
2 replies Latest Post - ‏2012-01-22T21:43:33Z by cansomeonehelpme
MarkBohannon
MarkBohannon
1 Post
ACCEPTED ANSWER

Pinned topic ADODB.Connection - Provider Not Found using Visual Basic for Applications

‏2011-12-16T22:29:03Z |
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.

Code Snippet
==============
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
Thanks,
Mark
Updated on 2012-01-22T21:43:33Z at 2012-01-22T21:43:33Z by cansomeonehelpme
  • Nodlu
    Nodlu
    1 Post
    ACCEPTED ANSWER

    Re: ADODB.Connection - Provider Not Found using Visual Basic for Applications

    ‏2011-12-20T12:35:33Z  in response to MarkBohannon
    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.
    Regards

    Didier
  • cansomeonehelpme
    cansomeonehelpme
    1 Post
    ACCEPTED ANSWER

    Re: ADODB.Connection - Provider Not Found using Visual Basic for Applications

    ‏2012-01-22T21:43:33Z  in response to MarkBohannon
    has anyone else ran into this problem and got it resolved.
    thanks