4 Connecting to Oracle Database Manually

The following sections describe establishing a connection to Oracle Database manually without any build tool:

4.1 Downloading JDBC Driver and Other JARs

This section lists the steps to download JDBC drivers and other JARs.

Make sure to complete all the steps from the Prerequisites section.

Download ojdbc8-full.tar.gz from OTN and unzip the contents to your classpath.

Note:

ojdbc8-full.tar.gz contains the latest JDBC driver (ojdbc8.jar) and UCP as a client side connection pool (ucp.jar).

4.2 Building and Running a Sample Java Program

This section lists the step to build and run a sample Java program.

  1. Compile the Java program.
    Make sure to provide the correct path for the required JARs in the classpath.
    javac -classpath ./lib/ojdbc8.jar:./lib/ucp.jar com/oracle/jdbctest/QuickStart.java
  2. Run the sample Java program.
    Make sure to provide the correct path for the required JARs in the classpath.
    java -classpath ./lib/ojdbc8.jar:./lib/ucp.jar:. com.oracle.jdbctest.QuickStart
Sample Output:

You will see the queried rows returned from the new table todoitem and a message Congratulations! You have successfully used Oracle Database as shown in the following screen:


Sample Output