
Hi, I have written the following servlet:
[code] package com.nitish.servlets; import javax.servlet.*; import java.io.*; import java.sql.*; import javax.sql.*; import oracle.sql.*;
public class RequestServlet extends GenericServlet{ public void init(ServletConfig sc)throws ServletException{ try{ Class.forName("oracle.jdbc.driver.OracleDriver"); }//try catch(Exception e){ throw new ServletException("Unable to load the driver"); }//catch }//init public void service(ServletRequest req,ServletResponse res)throws ServletException,IOException{ String name=req.getParameter("name"); String college=req.getParameter("college"); String university=req.getParameter("university"); String contactno=req.getParameter("contactno"); String[] course=req.getParameterValues("Course"); String photo=req.getParameter("photo"); byte []b=photo.getBytes(); //ByteArrayInputStream bis=new ByteArrayInputStream(b); Blob b1=new SerialBlob(b); PrintWriter out =res.getWriter(); Connection con=null; PreparedStatement ps=null; try{ con=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe","system","nitish"); ps=con.prepareStatement("insert into stenquiry values(?,?,?,?,?)"); ps.setString(1,name); ps.setString(2,college); ps.setString(3,university); ps.setString(4,contactno); ArrayDescriptor ad=ArrayDescriptor.createDescriptor("COURSEARRAY",con); ARRAY a=new ARRAY(ad,con,course); ps.setArray(5,a); ps.setBlob(6,b1); //ps.setBlob(6,bis); ps.executeUpdate(); out.println("Records Inserted Successfully"); }//try catch(Exception e){} finally{ try{ ps.close(); con.close(); }//try catch(Exception e){ e.printStackTrace(); }//catch }//finally }//service }//class [/code]
The problem I am facing is when I tried to compile the code, it gave me error saying that cannot find symbol:SerialBlob(); , while I have set the classpath for ojdbc14.jar prior to compilation.
And instead of using blob object in setBlob(), I also tried to use input stream. It compiled successfully, but when I executed the program, it gave me error as follows:
java.lang.AbstractMethodError: oracle.jdbc.driver.T4CPreparedStatement.setBlob(ILjava/io/InputStream;)V com.stech.servlets.RequestServlet.service(RequestServlet.java:40) I am not getting why is this happening.
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.