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 2019
- 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 2019 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.
- In Visual Studio, click
.
- In the
Create a new project dialog box, select
COBOL from the
Language drop-down list.
- Select
SQL Server Database Project.
- In the
Name field, type
SQLCLRTutorial.
- In the
Location field, specify a directory in which to store the project; then click
Create.
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
-
- From the Solution Explorer, double-click
Properties under your
SQLCLRTutorial COBOL project.
- On the
SQL tab, select
OpenESQL from the
ESQL Preprocessor drop-down list.
- Click
Add.
- On the
Available Directives list, click
DBMAN; then click
OK.
- 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.
- Click
Save ().
- From the Solution Explorer, open the project properties for the
.Publish project.
- On the
Project Settings tab, set the
Target Platform to the version of Microsoft SQL Server that you are using.
- On the
Debug tab, click the
Edit button associated with
Target Connection String.
- In the
Server Name field, type
. (dot) to indicate the local SQL Server instance.
- From the
Database name drop-down list, select
SQLCLR_Test; then click
OK.
- Click
Save (), and then close both Properties windows.
- Phase 4: Set OpenESQL Assistant Options
-
- In Visual Studio, click
Tools > Options > Micro Focus > OpenESQL Assistant.
- In the
Mode field, click the drop-down list and select
ADO.NET.
- 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.