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 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:
- Create a root directory for your JDBC resources. This directory is for storing JAR files and properties files. For example,
/home/jdbcrsc.
- Create a subdirectory to the root directory in which to store data source files. For example,
/home/jdbcrsc/DataSources.
Required Resources
The resources required to build and execute JDBC applications are:
- JDBC Drivers
- We recommend that you copy the appropriate driver file or files to the root directory you created for your JDBC resources.
To see a list of currently supported drivers, see
Additional Software Requirements on UNIX
- 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. 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.