JDBC With Oracle Instant Client Using Eclipse

These instructions assume you are working on one of the MCS Department Macs, which have the Oracle Instant Client software installed.

  1. Create a new Java project in Eclipse.

  2. Right click on the project folder, select Build Path, and from the submenu select Add External Archives...

  3. In the JAR Selection panel that comes up, navigate to /Users/Shared/instantclient_11_2/ojdbc6.jar as shown here and click Open:
    selecting /Users/Shared/instantclient_11_2/ojdbc6.jar

  4. Add a new class to the project containing your JDBC program.

  5. Try running the program; it should fail with an error because the necessary dynamically loaded library isn't found.

  6. Right click on your class in the project explorer, select Run As, and from the subment select Runc Configurations...

  7. Select the Environment tab within the Run Configuration panel, as shown here:
    the Environment tab

  8. Click New..., fill in the New Environment Variable panel as shown here, and click OK:
    setting DYLD_LIBRARY_PATH to /Users/Shared/instantclient_11_2

  9. The Environment tab should now show the environment variable as shown here; click Run and your program ought to run at least past the point of loading in the library:
    the Environment tab with a variable set