Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


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
  • 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: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

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

Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
This article will show, step by step, how to integrate R code into a R Sweave document
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…
Suggested Courses

571 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