5. Connecting to Ingres Using JDBC : Run a Java Program
Share this page                  
Run a Java Program
In this example, we connect to the Ingres II instance to testdb database and run the Java program named jdbc_connect_example.
The program is in the directory: C:\javaprograms\jdbc_connect_example.java.
JDK 1.8 (64 bit) is required to compile the program.
To configure your environment
1. Open a Windows command prompt (cmd.exe).
2. Ensure that you have a javac executable in your PATH variable pointing to a JDK 1.8 installation. For example: set PATH=C:\Program Files\Java\jdk1.8.0_45\bin;%PATH%.
Note:  The path may be different on your system depending on your JDK version.
3. Add iijdbc.jar and directory containing the Java program to CLASSPATH. For example:
set CLASSPATH=C:\Program Files\Actian\Ingres II\ingres\lib\iijdbc.jar;C:\ javaprograms;%CLASSPATH%
To compile and run the program
1. From the command prompt, configured as in the previous steps, change directory to the directory containing the Java program:
cd "C:\javaprograms"
2. Compile the program:
javac jdbc_connect_example.java
3. Run the program:
java jdbc_connect_example