ClassNotFoundException
hi
Can anyone help me out in reaching the solution for ClassNotFoundException. Im using J2SDK1.4 and the applcation server/Servlet engine is J2EESDK1.3.1 and the database is Oracle 9i.
Im working environment is Windows2000.
The exception is:
Database Driver not found
java.lang.ClassNotFoundException: oracle.jdbc.driver.OracleDriver
java.lang.NullPointerException
Error Inserting the Data into the Table
Error insertting the data
The Servlet Code is
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
import javax.sql.*;
import java.sql.*;
public class LoginSAPOnline extends HttpServlet
{
Connection dbcon;
public void doPost(HttpServletRequest req, HttpServletResponse res) throws ServletException,IOException
{
// Establishing Connection with database
try
{
Class.forName("oracle.jdbc.driver.OracleDriver");
dbcon=DriverManager.getConnection("jdbc:oracle:thi n:@bbsu-2:1521:keonline","system","knowledge");
System.out.println("Connection Established");
}
catch(ClassNotFoundException e)
{
System.out.println("Database Driver not found");
System.out.println(e.toString());
}
catch(Exception e)
{
System.out.println(e.toString());
}
res.setContentType("text/html");
PrintWriter out=res.getWriter();
String username=req.getParameter("username");
String password=req.getParameter("password");
String previledge=req.getParameter("previledge");
int rows=0;
try
{
PreparedStatement s=dbcon.prepareStatement("insert into login_info(username,password,previledge) values (?,?,?)");
s.setString(1,username);
s.setString(2,password);
s.setString(3,previledge);
rows=s.executeUpdate();
}
catch(Exception e)
{
System.out.println(e.toString());
}
if(rows==0)
{
System.out.println("Error Inserting the Data into the Table");
System.out.println("Error insertting the data");
}
else
{
System.out.println("The values have been inserted into the table successfully");
}
}
}
I have also downloaded ojdbc14.jar and i've pasted it in
J2SDK1.4.2_04\jre\lib, this is my JDK path..
i've also set the path and Classpath
Path : E:\oracle\B11\817\bin;C:\Program Files\Oracle\jre\1.3.1\bin;C:\Program Files\Oracle\jre\1.1.8\bin;C:\sapdb\programs\bin;C :\sapdb\programs\pgm;%SystemRoot%\system32;%System Root%;%SystemRoot%\System32\Wbem;c:\j2sdk1.4.2_04\ bin;c:\j2sdkee1.3.1\bin;j2sdk1.4.2_04\jre\lib
Classpath:C:\j2sdk1.4.2_04\lib;c:\j2sdkee1.3.1\lib \j2ee.jar
Pls tell me where i'm going wrong..
B.Swaminathan
Mobile:+91 9886510453
|