AnsweredAssumed Answered

connect to oracle 10g

Question asked by snowaja on Jan 20, 2010
Latest reply on Jan 28, 2010 by mikeh
I want to connect alfresco enterprise 3.2 with oracle 10g and i write this code..

import java.sql.*;

public class OracleOciConnection {

    public static void main(String args[])
{
try
{

Class.forName("oracle.jdbc.driver.OracleDriver");
Connection con = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:orcl","orcl","orcl");
Statement stmt=con.createStatement();
ResultSet rset =stmt.executeQuery("select * from table1");
while(rset.next())
{
System.out.print(rset.getString(1));
}
System.out.println("connected to oracle using oci driver");
con.close();
}
catch(Exception ex)
{
ex.printStackTrace();
}
}
}


it okey when i compile but there have error when i execute..like..

java.lang.ClassNotFoundException: oracle.jdbc.driver.OracleDriver
    at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
    at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:169)
    at OracleOciConnection.main(OracleOciConnection.java:10)


have any get the solution?? :?:  or other solution :idea:

should i set the class path =C:\oraclexe\app\oracle\product\10.2.0\server\jdbc\lib\ojdbc14.jar

but in my pc there only C:\oracle\product\10.2.0..and haven't the server folder..why it occur like that :!:

Outcomes