This document shows the basic steps to configure a linked server using the IBM i OLE DB data providers on an SQL server.
Resolving The Problem
This document shows the basic steps to configure a linked server using the IBM OLE DB data providers on an SQL server.
To configure a linked server using the IBM OLE DB data providers on an SQL server, you should do the following:
|1,||Open the SQL Server Enterprise Manager(SQL Server 2000) or SQL Server Management Studio(SQL Server 2005).|
|2,||Under the Console Root, expand Microsoft SQL Servers > SQL Server Group > Local > Security > Linked Servers for SQL Server 2000.|
For SQL Server 2005 expand Server Objects > Linked Servers.
|3,||Right-click on Linked Servers and select New Linked Server.|
|4.||Give your new Linked Server a title in the Linked server: text box.|
|5.||For the Server type, select Other data source and select the desired IBM OLE DB data provider.|
To decide which one of our providers would be best to use, you can refer to the following table from the IBM iSeries Access Programmer's Toolkit:
|6.||Type your Data source. This is the name of your IBM System i server.|
Provider string. The Provider string can contain any valid connection properties the provider supports. Connection properties are separated by a semi-colon.
Valid connection properties for the IBM i OLE DB provider can be found in the Programmer's Toolkit and in technote iSeries Access for Windows Custom Connection Properties for OLE DB.
In the example below the 'Default Collection' property is used. This is the default library that you connect to. If nothing is specified, the library of the user profile being used to connect will be used. If you wanted to browse the objects in QIWS, MYLIB, and YOURLIB, you could set the provider string to:
Default Collection=QIWS;Library List=MYLIB,YOURLIB;
Catalog. In Microsoft's terminology, Catalog is the relational database name. Typically you won't need to specify any value in this field. If you are accessing the libraries in an iASP you will need to insert the iASP RDB name in this field; otherwise, the *SYSBASE database name will be retrieved.
Note: For SQL Server 2005, the Product Name must have a value. It seems that almost any value works, aside from special characters. In the above example, 'DB2 for i' is used.
|8.||Click on the Security tab.|
|9.||Select the Be made using this security context radio button.|
|10.||Click OK. You should now see the linked server in the list.|
|11.||The OLE DB provider must be configured to allow inprocess; this only has to be done once per provider but if it is not done, you will get an error 7399 from SQL Server when you attempt to use the linked server. Under server Objects -> Linked Servers -> Providers right click on the provider being used (IBMDASQL, IBMDA400, or IBMDARLA) and select properties. |
Make sure "Allow Inprocess" is checked.
|12.||In SQL Server 2000, test the connection by expanding the linked server and double-clicking on Tables. You should see the list of tables in the right pane.|
Note: For SQL Server 2005, this test may not show a list of tables. This function seems dependent on what version of SQL Server 2005 is being used. For instance this doesn't work
with Express versions but seems to work with Developer or Enterprise editions.
In SQL Server 2005, you can test your linked server by running a simple query:
|1.||Click on New Query.|
|2.||Type the syntax of the query.|
Note: Some additional configuration steps are often needed to get this working with SQL Server 2005, particularly if this is the first OLEDB provider the SQL Server user has ever tried configuring.
If the user is getting "Msg 7399, Level 16, State 1, Line 1" type errors when attempting to run the sample select statement, this is a problem with the SQL Server service and the rights the user it is running under has. There are two things that can affect this. Note that this is all Microsoft code-related and is as-is at best. Assistance with this should be directed to Microsoft service and support.
o The SQL Server process is likely set to run under something other than the "Local System" account. You can check this in the SQL Server Configuration Manager tool (in the "Configuration Tools" folder in the start menu). This service may be set to run under the built in "Network Service" account or some other account. Change it to the "Local System" account and let Windows restart the service.
o In the SQL Server 2005 Surface Area Configuration tool (also in the "Configuration Tools" folder), select "Surface Area Configuration for Features". On the new panel, select OLE Automation and make sure the "Enable OLE Automation" option is checked. This change should no longer be needed from V6R1 System i Access and beyond; however, up through V5R4 iSeries Access, there are still some OLE automation objects involved.
Was this topic helpful?
18 December 2019