Skip to main content

Visual cobol to db2 connectivity

  • June 29, 2017
  • 1 reply
  • 0 views

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

1 reply

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

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