title: connecting Oracle 10g Express Edition and Java
body: <p>I want to connect Oracle 10g Express Edition and Java, the steps that I have followed are:</p>
  
  <p>Configure my classpath with the following files:</p>
  
  <p>C:\oraclexe\app\oracle\product\10.2.0\server\jdbc\lib\ojdbc14.jar</p>
  
  <p>C:\Program Files\Java\jdk1.7.0_01\bin</p>
  
  <p>C:\oraclexe\app\oracle\product\10.2.0\server\BIN</p>
  
  <p>Then I have tried the following program to connect it with OCI driver:</p>
  
  <pre><code>import  java.sql.*;
  
  public class OracleOCIConnection
  {
     public static void main(String args[])
     {
        try
        {
        // load oracle driver
           Class.forName("oracle.jdbc.driver.OracleDriver");
        // connect using Native-API (OCI) driver
           Connection con = DriverManager.getConnection("jdbc:oracle:oci8:@","hr","hr" );
           System.out.println("Connected Successfully To Oracle using OCI driver");
           con.close();
        }
           catch(Exception ex)
           {
              ex.printStackTrace();
           }
     }
  }
  </code></pre>
  
  <p>and also this using the Thin driver:</p>
  
  <pre><code>import  java.sql.*;
  
  public class OracleThinConnection
  {
     public static void main(String args[])
     {
        try
        {
        // load oracle driver
           Class.forName("oracle.jdbc.driver.OracleDriver");
        // connect using Thin driver
           Connection con =  DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe","hr","hr");
           System.out.println("Connected Successfully To Oracle");
           con.close();
        }
           catch(Exception ex)
           {
              ex.printStackTrace();
           }
     }
  }
  </code></pre>
  
  <p>In both cases the program compiles, but the line that throws an error is:</p>
  
  <p>Class.forName("oracle.jdbc.driver.OracleDriver");</p>
  
  <p>Any help?
  Thanks</p>