How do you get the DB2 JDBC JNDI database connection with Visual COBOL for Eclipse?
This document covers working with OpenESQL applications under the Visual COBOL eclipse product lines, including some background on how things fit together, and an example of building and executing a sample program.
2. Software requirements
The document assumes that you already
Have a copy of Visual COBOL for Eclipse installed and licensed appropriately.
Have a copy of DB2 installed like db2 10.1 express version.
Have a copy of simple JNDI class library .jar file likesimple-jndi-0.11.4.1.jar
3. DB2 COBOL example
Create JVM project
create cobol program TestDate
Cut and paste the below program into the new program.
program-id. TestDate as "TestDate".
exec sql include sqlca end-exec.
01 hv-date pic x(10).
01 hv-int binary-long.
exec sql connect to sample end-exec
where empno = 120
move 999 to hv-int
display hv-date " = " hv-int " days"
exec sql disconnect end-exec
end program TestDate.
4. JNDI sample.properties file
Create file sample.properties file in c:\JavaTools\config that contains