How to create an OLE/DB connection string - Support

How to create an OLE/DB connection string

From Support

Jump to: navigation, search

The Problem

With RPG2SQL, the preferred way to connect to a remote database is to use a connection string, instead of a DSN (data source name). Figuring out a connection string for ODBC connections is not too difficult, but where do you find the provider names, etc., for OLE/DB connections?

One way is to use what are called data links. These were introduced in Windows 98 or so. You could right-click in Windows Explorer and find an option under New  ? for a data link. It was taken out in later versions for some reason.

But you can still make one easily. And it will contain the connection string you want when you’re done. Follow the directions listed here.

Open Windows Explorer to the directory where you want to create the data link (UDL).

border


Right-click in a blank area and roll your mouse over to New  ?; then click on Text Document.


You will have a new text document—you can change the name here.


Change the name to something with a udl extension.


You will get a warning about changing the extension. Click on Yes.


Now you have the new name for the data link.


Right-click on the data link and click on Properties.


The Properties dialog will appear.


Click on the Provider tab—you will see a list of OLE/DB providers.


Click on the provider you want to use—SQL Server in this example.


Click on the Connection tab.


Type the server name. It is usually an IP address or host name, perhaps with an instance name. Here it is the local computer.


Enter a user ID and password. Be sure that Blank password is unchecked, and that Allow saving password is checked.


Click on the down arrow to be able to see the databases on the server. Then select the default database.


Click on the Test Connection button.


A dialog will appear, giving the results of the test. If successful, click OK and continue. If not successful, you'll have to go back and fix something.


Click on OK to save the information in the data link. You will get a warning about saving the password—click Yes to continue.


Again, we see the data link listed in Windows Explorer.


Right-click on the data link, roll over Open With  ?, and click on NotePad or some other text editor.


You will see the connection string in NotePad. It is called an initstring here. Select everything from "Provider=" to the end and copy to the clipboard.


Go to the iSeries and open the RPG2SQL Integrator main menu.


Type option 11 and press Enter.


Paste the connection string into the ADO Data Source String/Login parameter. Then press Enter. Be sure the PC component is running first!


The connection was successful!

This article has been proofread by Jordan as of 09:30, 15 January 2008 (Central Standard Time)
Personal tools