How to use ADODB connect to DB2

Posted on 2005-03-30
Medium Priority
Last Modified: 2006-11-18
Hi Experts,

I am in a VBA(iFix) program.
I need to use ADODB to connect to DB2 database.

The sample code is below.
But I need to change from 'sql server' to 'DB2', since now I am using DB2 database.
May I know how to do it?

Thanks and Regards,


 conODBC.Open "driver= _
    & " SQL server};server=thunder;uid=sa;pwd=;database=master"
Question by:turbot_yu
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
LVL 53

Accepted Solution

Dhaest earned 2000 total points
ID: 13669330
OLE DB Provider for DB2 (from Microsoft)
For TCP/IP connections

oConn.Open = "Provider=DB2OLEDB;" & _
             "Network Transport Library=TCPIP;" &  _
             "Network Address=xxx.xxx.xxx.xxx;" & _
             "Initial Catalog=MyCatalog;" & _
             "Package Collection=MyPackageCollection;" & _
             "Default Schema=MySchema;" & _
             "User ID=MyUsername;" & _

For APPC connections

oConn.Open = "Provider=DB2OLEDB;" &  _
             "APPC Local LU Alias=MyLocalLUAlias;" &  _
             "APPC Remote LU Alias=MyRemoteLUAlias;" &  _
             "Initial Catalog=MyCatalog;" & _
             "Package Collection=MyPackageCollection;" & _
             "Default Schema=MySchema;" & _
             "User ID=MyUsername;" & _


Author Comment

ID: 13669767
still not work, I donot need tcp.
LVL 53

Expert Comment

ID: 13669792
Do you have the correct odbc-drivers ? What version of mdac do you have ?

Author Comment

ID: 13669932
where to find the mdac,
I can link to db2 by other method in same pc

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Having just graduated from college and entered the workforce, I don’t find myself always using the tools and programs I grew accustomed to over the past four years. However, there is one program I continually find myself reverting back to…R.   So …
The purpose of this article is to demonstrate how we can use conditional statements using Python.
The viewer will learn how to implement Singleton Design Pattern in Java.
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.
Suggested Courses

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question