Hi,
I need your help since the [EMAIL PROTECTED] is down.
I am getting following error for my JDBCServlet program.
I will be happy if u could send me some solution if u know.
Error: 500
Internal Servlet Error:
java.lang.NullPointerException:
at JDBCServlet.service(JDBCServlet.java:35)
at javax.servlet.http.HttpServlet.service(Compiled Code)
at com.sun.web.core.ServletWrapper.handleRequest(Compiled Code)
at com.sun.web.core.InvokerServlet.service(Compiled Code)
at javax.servlet.http.HttpServlet.service(Compiled Code)
at com.sun.web.core.ServletWrapper.handleRequest(Compiled Code)
at com.sun.web.core.Context.handleRequest(Compiled Code)
at com.sun.web.server.ConnectionHandler.run(Compiled Code)
other details:
==============
JSDK2.1, JDK1.2.1, WIN95, ORACLE7.2 SQL *NET 2.2, Netscape 4.5, IE4.0,
localhost:8080.
The same JDBC-ODBC driver works fine in an applet and application.
Th source code:
===============
import java102.sql.*;
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class JDBCServlet extends HttpServlet {
private Connection oracleConn;
public void init(ServletConfig conf) throws ServletException {
super.init(conf);
try{
Class.forName("java102.sql.DriverSJ");
oracleConn
=DriverManager.getConnection("jdbc:socket://localhost:5588/jdbc:odbc:Tcp-loopback","SCOTT","jack00");
}catch (ClassNotFoundException e) {
throw new UnavailableException (this,
"Couldn't find class: " + e.getMessage ());
}catch (SQLException se){
System.err.println("SQL Exception caught: " + se);
}
}
public void service(HttpServletRequest req, HttpServletResponse res)
throws ServletException {
int updresult;
res.setContentType("text/html");
try {
ServletOutputStream out = res.getOutputStream();
out.println("<html>");
out.println("<head>");
out.println("<title>Rockmania's JDBC Servlet</title>");
out.println("</head>");
out.println("<body>");
Statement stmt = oracleConn.createStatement();
updresult = stmt.executeUpdate("update emp set deptno = 30 where
empno = 7369");
out.println("Rows updated:" +updresult);
out.println("</body>");
out.println("</html>");
} catch(SQLException e) {
System.err.println("An SQL Exception was thrown.");
} catch(IOException e) {
System.err.println("An IOException was thrown.");
}
}
public void destroy(){
try {
oracleConn.close();
}
catch(SQLException e) {
System.err.println("An SQL Exception was thrown.");
}
}
}
Pls help me.
Thanx.
venkata
_______________________________________________________________
Get Free Email and Do More On The Web. Visit http://www.msn.com
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html