I am trying to create a linked server from MSSQL 2014  to DB2 11.1  I am able to create one linked server and get it to work with one DB.  I have not been able to figure out how to add additional catalogs(DB's).  Is it possible to use just one linked server for multiple databases.

Views: 290

Reply to This

Replies to This Discussion

Hello Mike,

I tried to connect to db2 11.1 from sqlserver 2016 using IBMOLEDB driver. It works partially. i.e I can get table column headers but having issues in getting data.

I did it through below TSQL:

Create a ODBC system DSN to connect to a db2 database and test the connection. My DSN name is "test"

My db2 11.1 database is also named "test".

Database 1 entry:
 Database alias                       = TEST
 Database name                        = TEST
 Local database directory             = C:
 Database release level               = 15.00

[CLI_ODBC>TEST]
DataSourceName=test
DataSourceType=User
DBALIAS=TEST
PWD=xxx
UID=xxx
ODBCParameters=Yes

USE [master]
GO
EXEC master.dbo.sp_addlinkedserver @server = N'TEST3', @srvproduct=N'db2', @provider=N'IBMOLEDB', @datasrc=N'test'
GO
USE [master]
GO
EXEC master.dbo.sp_addlinkedsrvlogin @rmtsrvname = N'TEST3', @locallogin = NULL , @useself = N'False', @rmtuser = N'loginID', @rmtpassword = N'password
GO
GO
EXEC master.dbo.sp_serveroption @server=N'TEST3', @optname=N'collation compatible', @optvalue=N'false'
GO
EXEC master.dbo.sp_serveroption @server=N'TEST3', @optname=N'data access', @optvalue=N'true'
GO
EXEC master.dbo.sp_serveroption @server=N'TEST3', @optname=N'dist', @optvalue=N'false'
GO
EXEC master.dbo.sp_serveroption @server=N'TEST3', @optname=N'pub', @optvalue=N'false'
GO
EXEC master.dbo.sp_serveroption @server=N'TEST3', @optname=N'rpc', @optvalue=N'false'
GO
EXEC master.dbo.sp_serveroption @server=N'TEST3', @optname=N'rpc out', @optvalue=N'false'
GO
EXEC master.dbo.sp_serveroption @server=N'TEST3', @optname=N'sub', @optvalue=N'false'
GO
EXEC master.dbo.sp_serveroption @server=N'TEST3', @optname=N'connect timeout', @optvalue=N'0'
GO
EXEC master.dbo.sp_serveroption @server=N'TEST3', @optname=N'collation name', @optvalue=null
GO
EXEC master.dbo.sp_serveroption @server=N'TEST3', @optname=N'lazy schema validation', @optvalue=N'false'
GO
EXEC master.dbo.sp_serveroption @server=N'TEST3', @optname=N'query timeout', @optvalue=N'0'
GO
EXEC master.dbo.sp_serveroption @server=N'TEST3', @optname=N'use remote collation', @optvalue=N'true'
GO
EXEC master.dbo.sp_serveroption @server=N'TEST3', @optname=N'remote proc transaction promotion', @optvalue=N'true'
GO
USE [master]
GO
EXEC master.dbo.sp_MSset_oledb_prop N'IBMOLEDB.test', N'AllowInProcess', 0
GO

EXEC sp_linkedservers;
SRV_NAME  SRV_PROVIDERNAME SRV_PRODUCT SRV_DATASOURCE SRV_PROVIDERSTRING SRV_LOCATION SRV_CAT
TEST3   IBMOLEDB   db2   test NULL NULL NULL

select * from OPENQUERY(TEST3,'SELECT * FROM SYSCAT.TABLES');
TABSCHEMA TABNAME
It didn't bring the data, only headers with the following message. Hope more research will get the data.
Msg 7399, Level 16, State 1, Line 1
The OLE DB provider "IBMOLEDB" for linked server "TEST3" reported an error. Access denied.
Msg 7350, Level 16, State 2, Line 1
Cannot get the column information from OLE DB provider "IBMOLEDB" for linked server "TEST3".
If you get more luck, let me know.
Rgds,
Thiru Swamy

Thiru,

I appreciate your feedback.  I am new to DB2 and still learning but i would verify the permissions you have set for your linked server account as it looks like maybe you don't have them set properly.

Thanks,

Michael Jett

RSS

Events

Latest Activity

2 events by Surekha Parekh were featured
Jan 12
Surekha Parekh updated an event

Modernize IBM Z Apps for Hybrid Cloud using APIs at webcast

January 11, 2021 all day
Available on-demand now, this webinar will show you how to provide access to curated, proven and high-performance applications by turning your existing IBM Z® assets into security-rich, consumable and managed APIs. You will also learn some key considerations on how to choose among the numerous API and integration solutions available. Click the link to watch:…See More
Jan 11
francisco venegas liked Surekha Parekh's event Db2 12 Exploiting new functions and Migration Planning PART 1
Jan 11
Mark liked Surekha Parekh's video
Dec 17, 2020
Judith Talavera posted an event

Modernize IBM Z Apps for Hybrid Cloud using APIs at webcast

December 16, 2020 to February 16, 2021
Available on-demand now, this webinar will show you how to provide access to curated, proven and high-performance applications by turning your existing IBM Z® assets into security-rich, consumable and managed APIs. You will also learn some key considerations on how to choose among the numerous API and integration solutions available. Click the link to watch:…See More
Dec 17, 2020
An event by Janttu Lindroos was featured

Finland Db2 User Group (FiDUG) Seminar at IBM Finland

December 10, 2020 from 9am to 5pm
More info will be available later on. Stay tuned.See More
Dec 4, 2020
An event by Michael Strelczuk was featured
Thumbnail

MDUG - Michigan Db2 User Group Seminar at Four Points by Sheraton, Novi

December 9, 2020 from 8:15am to 4pm
Check out our MDUG web site for upcoming Seminar details and past Seminar presentations, etc.:http://www.mdug.org/New to MDUG?Please see content underHome About MDUGFor Seminar Reservations, please review the MDUG site content under…See More
Dec 4, 2020
An event by Surekha was featured
Thumbnail

Surprise in store! Join the Db2 for z/OS Spotlight session for REALLY new news from the lab at http://ibm.biz/MoTownsend_IBM2020

December 7, 2020 from 11am to 12pm
Surprise in store! Join the Db2 for z/OS Spotlight session for REALLY new news from the labIDUG EMEA 2020 Spotlight session Available today on replay  http://ibm.biz/MoTownsend_IBM2020 Db2 12 for z/OS® took Db2 to a new level, by extending the core capabilities and empowering the future. IBM extended the core with new…See More
Dec 4, 2020
Jonathan Sloan posted an event

IBM Z and IBM Cloud Pak for Data - Better Together at Webcast - East Coast U.S. time zone

December 3, 2020 from 11am to 12pm
Register at http://ibm.biz/IBMZandBetterTogetherWoD.IBM Cloud Pak for Data is a fully integrated data and AI platform that modernizes how businesses collect, organize and analyze data and infuse AI throughout their organization. And now IBM has introduced IBM Cloud Pak for Data on IBM Z, a highly secure private cloud for your enterprise data that allows you to adapt, transform and compete more effectively. Join this webcast to learn how IBM…See More
Dec 4, 2020
Surekha posted an event
Thumbnail

Surprise in store! Join the Db2 for z/OS Spotlight session for REALLY new news from the lab at http://ibm.biz/MoTownsend_IBM2020

December 7, 2020 from 11am to 12pm
Surprise in store! Join the Db2 for z/OS Spotlight session for REALLY new news from the labIDUG EMEA 2020 Spotlight session Available today on replay  http://ibm.biz/MoTownsend_IBM2020 Db2 12 for z/OS® took Db2 to a new level, by extending the core capabilities and empowering the future. IBM extended the core with new…See More
Dec 4, 2020
Dragica Smintic liked Mateja Jankovič's event SQLAdria Virtual Event
Nov 25, 2020
Jonathan Sloan posted an event

IBM Z and IBM Cloud Pak for Data - Better Together at Webcast - East Coast U.S. time zone

December 3, 2020 from 11am to 12pm
Register at http://ibm.biz/IBMZandBetterTogetherWoD.IBM Cloud Pak for Data is a fully integrated data and AI platform that modernizes how businesses collect, organize and analyze data and infuse AI throughout their organization. And now IBM has introduced IBM Cloud Pak for Data on IBM Z, a highly secure private cloud for your enterprise data that allows you to adapt, transform and compete more effectively. Join this webcast to learn how IBM…See More
Nov 23, 2020
Massimo Verzì liked Adrian Collett's group DUGI - Db2 User Group Italia
Nov 20, 2020
Profile Icon via Twitter
Enjoy complimentary visit #IBM Expo at #IDUGDb2 EMEA 2020. Virtual Expo is available 24x7 - check out our compli… https://t.co/pAqtzMLvfm
TwitterNov 19, 2020 · Reply · Retweet
Carol Davis-Mann posted a blog post

DB2 v11.5.4 REST API – Part One Setup and Configuration

By James CockayneEnabling clients to interact via HTTP GET/POST requests the REST API functionality provides clients a lightweight, modern interface to data stored in DB2 databases.  In this series we look at how to get started with the REST API from the DBA’s perspective, starting in part one with how to get the service up and running.…See More
Nov 18, 2020
Roberto S Chirinos liked Surekha's blog post What year was IBM Db2 invented?
Nov 17, 2020

Bringing Db2 enthusiasts together virtually. Expert or novice, distributed or mainframe, this is the place for everything DB2.

Forum

Replaying past database activities

Started by Shaun Hide in Security and DB2. Last reply by Alexander Dashevsky Nov 17, 2020. 1 Reply

I would need to know who modified table data on a certain day.I do have my backups and database logs available.DB2audit was however not activated at this point.How would i  be able to access this information?Continue

Tags: #DataAccess

Db2 is developer inclusive and preview of Db2 11.5.5

Started by Kip in What's hot ? Nov 4, 2020. 0 Replies

This digital event examines how enterprises can become smarter with a data management system that is developer-inclusive. During this session, participants will get to learn how Db2 integrates with a broad array of programming languages, employs…Continue

© 2021   Created by Surekha Parekh.   Powered by

Badges  |  Report an Issue  |  Terms of Service