Error connection to Oracle from JSP
843838Jun 22 2007 — edited Jun 24 2007I am trying to connect to oracle from jsp
this is the class which I have created to test. I have atken this class from oracle documentation
package user;
import java.sql.*;
import oracle.jdbc.pool.OracleDataSource;
public class JdbcTest {
public static void getName () {
// Create DataSource and connect to the local database
try
{
OracleDataSource ods = new OracleDataSource();
ods.setURL("jdbc:oracle:thin:@//MOMJI:1521/TESTDB");
ods.setUser("system");
ods.setPassword("testdb");
Connection conn = ods.getConnection();
// Query the employee names
Statement stmt = conn.createStatement ();
ResultSet rset = stmt.executeQuery ("SELECT name FROM ani");
// Print the name out
while (rset.next ())
System.out.println (rset.getString (1));
//close the result set, statement, and the connection
rset.close();
stmt.close();
conn.close();
}
catch(Exception e)
{
System.out.print("ERROR"+e.getMessage());
}
}
}
Now when I create an instance using useBean in jsp file I get an error that
java.lang.NoClassDefFoundError: oracle/jdbc/pool/OracleDataSource
I dont understand what to do. If you have any othet way of accessing the DD then plz tell.
I have set the classpath for ojdbc14.jar and orai18n.jar.
Please reply