This post 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:
Note: Microsoft SQL Server is SQL based. The IBMDASQL OLE DB provider is the provider that should be used with Microsoft SQL Server linked servers.
In the following example, I am using the IBMDASQL provider:
|6.||Type your Data source. This is the name of your IBM System i server.|
|7.||Optional: Provider string. The Provider string can contain any valid connection properties the provider supports. Connection properties are seperated by a semi-colon. Valid connection properties for the IBM i OLE DB provider can be found in the Programmer’s Toolkit. 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. Catalog. In MIcrosoft’s terminology, Catalog is the relational database name. If your RDB name matches the IBM i server name then you do not need to provide a value. If the RDB name does not match the IBM i server name then the RDB name should be inserted into the Catalog field.|
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.||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.
The OLE DB provider must be configured to allow inprocess. 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.
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.
Source: IBM Support