Previous Topic Next topic Print topic


Tutorial: Catalog a Connection

Before you can connect to the SQL Server database you created earlier, you must catalog it using the ADO.NET Connection Editor.

Requirements
Before attempting this tutorial, you must complete the following tutorials in the order listed:
  • Tutorial: Create a SQL Server Database
  • Tutorial: Create and Configure a Visual Studio Project
  • Tutorial: Set OpenESQL Assistant Configuration Options
Phase 1: Start the OpenESQL Assistant
You can start the OpenESQL Assistant from the Start menu or from within Visual COBOL. In this tutorial, we opt to start the OpenESQL Assistant from within Visual COBOL.
  • In Visual COBOL, click View > Micro Focus SQL Tools > OpenESQL Assistant.
Phase 2: Start the ADO.NET Connection Editor
You can start the ADO.NET Connection Editor from your desktop's Start menu, from the View menu in Visual COBOL, or from within the OpenESQL Assistant. Here, we start it from within the OpenESQL Assistant.
  • From the OpenESQL Assistant, click Create New QueryADO.NET Connection Editor.
Phase 3: Catalog the OESQLDemo Connection
In this phase, we catalog a 32-bit (default) connection to our SQL Server database.
Important: If you are running on a 64-bit machine, you must catalog a 64-bit connection in addition to the 32-bit connection. Both connections have the same data source name. To do this, complete all of the steps in this phase, and then repeat the steps of this phase with the following change:
  • Before performing step 1, on the main window, click Settings > Availability > 64 bit.
  1. On the main window of the ADO.NET Connection Editor, click Add. This starts the Add an ADO.NET Connection wizard.
  2. Click Next.
  3. In the Data Source Name field, type OESQLDemo, which is the name of your connection; then click Next.
  4. In the .NET Data Providers grid, select SqlClient Data Provider; then click Next.
  5. Modify the following fields on the Connection Settings grid, providing the appropriate values:
    Field Value
    Data Source (local)
    Initial Catalog OESQLDemo
    Integrated Security True
  6. Click Next to review your settings.
  7. Click Finish to add the new connection. This returns you to the main window.
  8. Click Test to ensure the connection works properly; then click OK to clear the message.
Phase 4: Close the ADO.NET Connection Editor
  • To close the ADO.NET Connection Editor, click the close button in the upper right corner of the main window. This returns you to the OpenESQL Assistant, which now lists the OESQLDemo connection.
Phase 5: Refresh the Database Connection
For Visual Studio to recognize the connection you have cataloged, you must refresh it in the Server Explorer.
  1. From the Visual Studio IDE, open the Server Explorer.
  2. Right-click the connection listed for OESQLDemo, and select Refresh.

This completes the tutorial. Next, please complete Tutorial: Build and Test a Query.

Previous Topic Next topic Print topic