JDBC Resources

To build and execute JDBC applications, Visual COBOL must have access to a certain set of resources. The specific resources required vary depending on the type of database and type of application server used by the application.

Important: If you build your project using the SQL(CHECK) compiler directive, OpenESQL requires access to the same resources used when executing the application. In this case, before building the application, you must configure your Visual COBOL project or your JDBC environment for application execution.

Using SQL(CHECK) also requires that you use JNDI DataSource objects, either with Simple-JNDI, or JNDI services provided by a Java Application Server.

Recommendations

In the interest of keeping your JDBC resources organized and easily accessed, we offer the following recommendations:

Directory Structure
We recommend that you create a directory structure on a local or shared drive in which to store your JDBC project resources:
  1. Create a root directory for your JDBC resources. This directory is for storing JAR files and data source files. For example, c:\jdbcrsc (Windows) or /home/jdbcrsc (UNIX).
  2. Create a subdirectory to the root directory in which to store the JDBC properties file. For example, C:\jdbcrsc\jdbcProps (Windows) or /home/jdbcrsc/jdbcProps (UNIX).
User Library
You can reduce the work required to satisfy JDBC resource dependencies by creating an Eclipse user library for your workspace. You define a user library to contain all of the JAR files required for your JVM Build Path. This enables you to point to the user library when building and executing applications, rather than reassembling the JAR components of the JVM Build Path from scratch for each JVM COBOL project. The library import and export features enable you to reuse a single user library across multiple workspaces.

Required Resources

The resources required to build and execute JDBC applications are:

JDBC Drivers
Your Visual COBOL project must be able to access the JDBC driver provided by your database. We recommend that you copy the appropriate driver file or files to the root directory you created for your JDBC resources. See the OpenESQL section in the Database Management Systems (DBMSs) topic under Additional Software Requirements to learn the currently supported JDBC driver versions.
JNDI Library
JNDI provides a way to define a database connection and make it accessible to multiple applications. The JNDI library file, usually a JAR file, contains the information required to connect to your JDBC database, including pointers to additional resources. JNDI requires its own configuration, which must be done before you can use the JNDI library.

You have several options with regard to JNDI. For example, each application server offers a JNDI implementation that you can use. However, for development and evaluation purposes, we recommend that you use a third-party JNDI server, Simple-JNDI. The Simple-JNDI package enables you to create and register JNDI DataSource objects, independent of your application server, for use with Visual COBOL projects. To use Simple-JNDI, follow the procedure presented in To install and configure Simple-JNDI.

JNDI DataSource Objects
A DataSource object is a properties file that contains the specifications required to connect to your database. To use a DataSource object, it must be registered on a JNDI server. For instructions on using Simple-JNDI to create and register a DataSource object, see To create a JNDI DataSource object. To see the contents of a variety of example DataSource objects, see Sample DataSource Object Files.
Additional Resources for Microsoft SQL Server

On Windows platforms, if you are not using Windows authentication, no additional resources are required. However, if you are using Kerberos authentication with a driver version of 4.0 or later, then you do not need to enable integrated authentication, but you might need to follow additional configuration steps as described in the driver documentation.