In this article we going to look into creating a heterogeneous linked server. i.e. We are going to create a linked server to SYBASE database server from SQL Server environment and then going to query datas from Sybase. First step in heterogeneous linked server is to create a ODBC connection to that RDBMS platform. For creating ODBC connection we need the ODBC drivers for that RDBMS platform. In this case we need Sybase driver in client machine, this is not included in windows so you need to download it from Sybase Website. Lets discuss on this step by step
SQL Server 2008
Sybase ASE Developer Edition 15.02
Sybase ODBC Driver 3.51
Sybase DBName : sqlarticles (authors table with 4 test records)
- Download Sybase ODBC drivers from the link Get Sybase ODBC Driver . Please note from Sybase ASE 15, Sybase will not ship the 3rd party DataDirect ODBC driver, Sybase has developed their own ODBC driver and it will be shipped.
- Install the Sybase driver from the downloaded setup.
- Once installation completed go to Run> Type odbcad32 and press enter
- In the ODBC admin window go to System tab as shown below
- When you click on Add button a list of ODBC drivers available in the system will be shown, select Adaptive Server Enterprise (this will not be displayed if you havent installed Sybase ODBC Drivers) and then click finish button
- Now you will be shown with the ODBC driver configuration, all the fields in the window are self explanatory hence fill all the details required (you can also go to other tabs for other ODBC options) and click on Test Connection button to test the ODBC connection. Now another window will pop up to enter the password, just enter the credential and click OK as shown below
- Now you have created the ODBC connection successfully, the next step is to create a new linked server in SQL Server.
- Open Management studio and connect to the SQL Server Instance
- Expand Server Objects in object explorer and right click on Linked Servers folder and then click on New Linked server in the menu as shown below
- New Linked server window will popup, fill all the details required. Provide the name for the Linked server, Select Other Data Source Option button, Select Provider as Microsoft OLE DB Provider for ODBC Drivers and provide the ODBC name in the field Data Source.
- Since we dont have the facility to enter the credential details in ODBC, we need to update the details here. To accomplish this, click on the Security tab in the left hand pane and provide Sybase credentials as shown below
- Thats it we have created a linked server to Sybase server from SQL.
Querying Data from Sybase Linked Server
Connect to SSMS and open a new query window and type the query to retrieve datas from Sybase linked server.
select name from sybase.sqlarticles.dbo.authors
Leave a Reply