New Ranks & Badges For The Community!
Notice something different? The ranks and associated badges have gone "Star Fleet". See what they all mean HERE
Highlighted
Absent Member.
Absent Member.
591 views

Visual cobol to db2 connectivity

Hi

I am using visual COBOL , I want to know exactly how to connect to db2 database and start using

$SET DB2(DBMAN = ODBC)

exec sql
connect to ODBC DSN Name
end-exec

Is it enough or do I need to add anything in my visual cobol

0 Likes
1 Reply
Micro Focus Contributor
Micro Focus Contributor

Hi,

If you are connecting to DB2 via ODBC, you should use the OpenESQL (compiler directive: SQL) instead of DB2 ECM (compiler directive: DB2).

Assuming you have ODBC setup correctly, what you need is

$SET SQL(DBMAN=ODBC)

EXEC SQL

   CONNECT ...

END-EXEC

You can read more about the OpenESQL at

For VS,

http://documentation.microfocus.com/help/topic/com.microfocus.eclipse.infocenter.visualcobol.vs2015/BKDBDBESQL.html

For Eclipse,

http://documentation.microfocus.com/help/topic/com.microfocus.eclipse.infocenter.visualcobol.eclipsewin/BKDBDBESQL.html

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.