473,394 Members | 1,761 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Accessing DB2 from SQL 2005 (OLEDB)

I've seen a number of posts from frustrated folks about this topic,
with not much offered as a solution. I actually managed to get this to

work today, so I thought I'd post for the benefit of the community.

My team went through a number of puzzling errors in getting this work,
like the CLI0150E (Driver not capable) error, and a variety of DB2OLEDB

errors. None which were really indicative of the problem. Here's how
I got a read/write connection to function between SQL 2005 and a DB2
UDB database on AIX (v8.2)
1) First I configured a UDL data source as described in this Microsoft
article: http://support.microsoft.com/kb/218590/ This created the
resulting provider string:
Here is the resulting provider string:
[oledb]
; Everything after this line is an OLE DB initstring
Provider=DB2OLEDB;User ID=<masked>;Password=<masked>;Initial
Catalog=<MYDBNAME>;Network Transport Library=TCP;Host CCSID=37;PC Code
Page=1252;Network Address=myserver.corp.something.org;Network
Port=50000;Package Collection=<TABSCHEMA>;Default
Schema=<TABSCHEMA>;Process Binary as Character=False;Units of
Work=RUW;Default Qualifier=<TABSCHEMA>;DBMS Platform=DB2/6000;Defer
Prepare=False;Persist Security Info=True;Connection Pooling=True;Derive

Parameters=False;
2) Then I created the linked server in SQL 2005:
/****** Object: LinkedServer [MYDB2LINKEDSERVER] Script Date:
01/18/2007 15:10:00 ******/
EXEC master.dbo.sp_addlinkedserver @server = N'OLEDB2',
@srvproduct=N'Microsoft OLE DB Provider for DB2',
@provider=N'DB2OLEDB', @datasrc=N'<MYSERVER>',
@provstr=N'Provider=DB2OLEDB;Initial Catalog=<MYDBNAME>;Network
Transport Library=TCPIP;Host CCSID=37;PC Code Page=1252;Network
Address=<myserver>.corp.nai.org;Network Port=50000;Package
Collection=NULLID;Process Binary as Character=False;Units of
Work=RUW;DBMS Platform=DB2/6000;Defer Prepare=False;Persist Security
Info=False;Connection Pooling=True;Derive Parameters=False;',
@catalog=N'<MYDBNAME>'
GO
EXEC master.dbo.sp_serveroption @server=N'OLEDB2', @optname=N'collation

compatible', @optvalue=N'false'
GO
EXEC master.dbo.sp_serveroption @server=N'OLEDB2', @optname=N'data
access', @optvalue=N'true'
GO
EXEC master.dbo.sp_serveroption @server=N'OLEDB2', @optname=N'dist',
@optvalue=N'false'
GO
EXEC master.dbo.sp_serveroption @server=N'OLEDB2', @optname=N'pub',
@optvalue=N'false'
GO
EXEC master.dbo.sp_serveroption @server=N'OLEDB2', @optname=N'rpc',
@optvalue=N'true'
GO
EXEC master.dbo.sp_serveroption @server=N'OLEDB2', @optname=N'rpc out',

@optvalue=N'true'
GO
EXEC master.dbo.sp_serveroption @server=N'OLEDB2', @optname=N'sub',
@optvalue=N'false'
GO
EXEC master.dbo.sp_serveroption @server=N'OLEDB2', @optname=N'connect
timeout', @optvalue=N'0'
GO
EXEC master.dbo.sp_serveroption @server=N'OLEDB2', @optname=N'collation

name', @optvalue=null
GO
EXEC master.dbo.sp_serveroption @server=N'OLEDB2', @optname=N'lazy
schema validation', @optvalue=N'false'
GO
EXEC master.dbo.sp_serveroption @server=N'OLEDB2', @optname=N'query
timeout', @optvalue=N'0'
GO
EXEC master.dbo.sp_serveroption @server=N'OLEDB2', @optname=N'use
remote collation', @optvalue=N'true'
3) Then, I had to manually change this option in SQL 2005 (There used
to be a button for it in SQL 2000, so you have to do it manually now)
exec master.dbo.sp_MSset_oledb_prop 'DB2OLEDB','AllowInProcess',1
*** IMPORTANT STEP. IT WON'T WORK WITHOUT IT!!**
4) Then I ran my SQL:
select * from MYDB2LINKEDSERVER.MYDBNAME.TABSCHEMA.MY_TABLE
insert into MYDB2LINKEDSERVER.MYDBNAME.TABSCHEMA.MY_TABLE
select MY_SQL_COL from MY_SQL_TABLE

Jan 19 '07 #1
0 4022

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Eugen Walcher | last post by:
Hello all, I've tried posting this same question on other newsgroups with no luck. This group seems to have a lot more activity so I apologize if you have seen it before. I'm trying to...
1
by: Evan Kontos | last post by:
I am having an issue w/regard to stored procedures. If I do the following: Dim OccCnctn As New OleDb.OleDbConnection Dim OccCmd As New OleDb.OleDbCommand Dim OccRdr As OleDb.OleDbDataReader...
3
by: Steve Teeples | last post by:
I am writing my first database application. I am unable to even get to first base because I can't seem to access the data in the database. Each time the "Fill" command is executed I get an...
5
by: samadams_2006 | last post by:
I'm having a problem in accessing a Microsoft Access Database in a VB.NET Web Application. It's so straight forward, I thought I'd walk you through all the details here: 1) I have a .NET Web...
11
by: Stephen Plotnick | last post by:
I upgraded from VB 2003 to VB 2005. I have a 4000 record table in Access that I'm using oleDB to do a data adapter fill to a Data Grid. In VB.2003 it takes 2-3 seconds to load the data grid in...
0
by: rathi.vis | last post by:
Problem:Jet 4.0 Ole DB Provider stops working the momemt SQL 2005 server is installed. Environmental steps: 1.Installed XP Sp2 2.Installed SQL 2005 Server with SP1 3.Trying to import...
3
by: Nathan Sokalski | last post by:
When I attempt to access a Microsoft Access database from my website, I recieve the following error: Server Error in '/' Application....
19
by: cj | last post by:
I'm getting terrible response times trying to pull data from VFP tables using .net--like 2 minutes! Can someone help? f:\arcust01 currently contains 187,728 records and is indexed on CUSTNO...
14
by: bill | last post by:
Can someone please show me an example of passing a string value into an sql statement in vb 2005? Something like this is what I'm after: Dim sqlButton1 As String = "Select * from tblAssets where...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.