Previous Topic Next topic Print topic


Tutorial: Create and Configure a Database Project

Takes you through the process of creating a Visual COBOL database project to use as you complete the remainder of these tutorials.
Requirements
Before attempting this tutorial, you must complete the following tutorials in the order listed:
  • Tutorial: Enable SQL CLR Integration
  • Tutorial: Create a Sample Database
Phase 1: Launch Visual COBOL for Visual Studio 2015
This varies depending on your version of Windows. See Starting Visual COBOL for details.
Phase 2: Create a New Database Project

The SQL CLR Integration feature in Visual COBOL for Visual Studio 2015 provides a project template named SQL Server Database Project, which is configured specifically for SQL CLR. Here, you create a Visual Studio project based on this template.

  1. In Visual Studio, click File > New > Project.
  2. Under Installed Templates, click COBOL > Database.
  3. From the drop-down list above the list of templates, select a .NET Framework to use.
  4. Click SQL Server Database Project.
  5. In the Name field, type SQLCLRTutorial.
  6. In the Location field, specify a directory in which to store the project; then click OK.

    Visual Studio creates a solution containing two projects: a COBOL project named SQLCLRTutorial, and a publishing project named SQLCLRTutorial.Publish. The .Publish project references the COBOL project.

Phase 3: Set Project Properties
  1. From the Solution Explorer, double-click Properties under your SQLCLRTutorial COBOL project.
  2. On the SQL tab, select OpenESQL from the ESQL Preprocessor drop-down list; then click Add.
  3. On the Available Directives list, click DBMAN.
  4. From the Value drop-down list, select ADO; then click OK.
  5. Click Add again.
  6. On the Available Directives list, click BEHAVIOR.
  7. From the Value drop-down list, select MAINFRAME; then click OK.
  8. On the COBOL tab, set the Warning level to Include recoverable errors (Level E).
  9. Open the project properties for the .Publish project.
  10. On the Project Settings tab, set the Target Platform to the version of Microsoft SQL Server that you are using.
  11. On the Debug tab, click the Edit button associated with Target Connection String.
  12. In the Server Name field, type . (dot) to indicate the local SQL Server instance.
  13. In the Select or enter a database name field, select SQLCLR_Test; then click OK.
  14. Click Save, and close the Properties window.
Phase 4: Set OpenESQL Assistant Options
  1. In Visual Studio, click Tools > Options > Micro Focus > OpenESQL Assistant.
  2. In the Qualify table with owner name field, click the drop-down list and select True.
  3. In the Type Stored Procedure field, select SQLCLR; then click OK.

This concludes this tutorial. Please continue with Tutorial: Create an ADO.NET Connection or Tutorial: Generate a COBOL Wrapper for a SQL CLR Stored Procedure.

Previous Topic Next topic Print topic