manojkithany
09-24-02, 14:19
| Hi Experts, I am using Apache 1.3.26 + Tomcat 4.0.4 + JBoss 3.0.3 and Oracle 9 db. I have written a small Java Applicaiton (Servlet) which needs to connect to my Oracle DB. My Application Server and DB Server are on DIFFERENT machine. My small application is: ------------------------------------------------------- import java.sql.*; import java.util.*; public class testdb { public static void main(String [] args) { String url = "jdbc:oracle:thin:@MY_HOST_ADDR:1521:MY_SID"; Connection con; Statement stmt; String query = "Select * from emp"; try { System.out.print("before "); Class.forName("oracle.jdbc.OracleDriver"); } catch (java.lang.ClassNotFoundException e) { System.out.print("catch"); System.err.print("ClassNotFoundException: "); System.err.println(e.getMessage()); } try { System.out.println("After Class.forname"); con = DriverManager.getConnection(url,"scott", "tiger"); System.out.println("AftergetConnection"); stmt = con.createStatement(); ResultSet rs = stmt.executeQuery(query); while (rs.next()) { String s = rs.getString("EMP_NAME"); System.out.println(s); } stmt.close(); con.close(); } catch (SQLException ex) { System.err.println("SQLException: " + ex.getMessage()); } } } ------------------------------------------------------- When I run this small java file I get following Error: ------------------------------------------------------ # javac testdb.java # java testdb Exception in thread "main" java.lang.NoClassDefFoundError: testdb ------------------------------------------------------ Do I need to configure any xml file or so in JBoss? I have JDBC Drivers loadede on my Oracle Server. Well, I have my Application Server and DB Server on different boxex. I also have my JDBC Drivers (eg: classes12.zip) located on my DB Server and am running my Application (testdb.class) from my Application Server. DO you think that is a concern. How could I tackle that? Any infor. on this appreciated. Please help. THANKS! Manoj G. Kithany |