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
Launch Visual COBOL for Visual Studio 2012
This procedure varies.
  • If your operating system is UAC-enabled, you should start Visual COBOL as an administrator. If you need instructions, see To start Visual COBOL as an administrator, and follow the instructions for your Windows version.
  • If your operating system is not UAC-enabled, you can start Visual COBOL as a regular user. If you need instructions, see To start Visual COBOL, and follow the instructions for your Windows version.
Create a New Database Project

The SQL CLR Integration feature in Visual COBOL for Visual Studio 2012 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.

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.
  3. Click Add.
  4. On the Available Directives list, click DBMAN; then click OK.
  5. Repeat steps 3 and 4, but this time add the BEHAVIOR directive.
    Note: The default value for both DBMAN (ADO) and BEHAVIOR (OPTIMIZE) are correct, so you don't need to make any value changes.
  6. Click Save (Save).
  7. From the Solution Explorer, open the project properties for the .Publish project.
  8. On the Project Settings tab, set the Target Platform to the version of Microsoft SQL Server that you are using.
  9. On the Debug tab, click the Edit button associated with Target Connection String.
  10. In the Server Name field, type . (dot) to indicate the local SQL Server instance.
  11. From the Database name drop-down list, select SQLCLR_Test; then click OK.
  12. Click Save (Save), and then close both Properties windows.
Phase 4: Set OpenESQL Assistant Options
  1. In Visual Studio, click Tools > Options > Micro Focus > OpenESQL Assistant.
  2. In the Mode field, click the drop-down list and select ADO.NET.
  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.