?
Solved

How to use ADODB connect to DB2

Posted on 2005-03-30
4
Medium Priority
?
1,019 Views
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,

Turbot


 conODBC.Open "driver= _
    & " SQL server};server=thunder;uid=sa;pwd=;database=master"
0
Comment
Question by:turbot_yu
[X]
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
4 Comments
 
LVL 53

Accepted Solution

by:
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;" & _
             "Password=MyPassword"

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;" & _
             "Password=MyPassword"

http://www.able-consulting.com/MDAC/ADO/Connection/OLEDB_Providers.htm#OLEDBProviderForDB2
0
 

Author Comment

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

Expert Comment

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

Author Comment

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

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