Servlets Program

Servlets Program

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.

View Answers









Related Tutorials/Questions & Answers:
Servlets Program
Servlets Program  Hi, I have written the following servlet: [code] package com.nitish.servlets; import javax.servlet.*; import java.io.*; import... executed the program, it gave me error as follows
servlets
servlets  why we are using servlets
Advertisements
servlets
servlets  what is the duties of response object in servlets
servlets
what are advantages of servlets  what are advantages of servlets   Please visit the following link: Advantages Of Servlets
Servlets
Servlets  How to edit and delete a row from the existing table in servlets
servlets
servlets  How do you communicate between the servlets?   We can communicate between servlets by using RequestDespatcher interface and servlet chaining
servlets
what is the architecture of a servlets package  what is the architecture of a servlets package   The javax.servlet package provides interfaces and classes for writing servlets. The Servlet Interface The central
Servlets
Servlets  How to check,whether the user is logged in or not in servlets to disply the home page
Servlets
. Anyways, please visit the following links: http://www.roseindia.net/servlets/introductiontoconfigrationservlet.shtml http://www.roseindia.net/servlets
servlets
servlets  why we require wrappers in servlets? what are its uses? Please explain   These wrappers classes help you to modify request...://www.roseindia.net/servlets/response-filte.shtml
servlets
servlets  How to open and read the contents of a text file in servlets?   Please visit the following link: Read text file using Servlet
servlets
servlets   Hi what is pre initialized servlets, how can we achives?   When servlet container is loaded, all the servlets defined in the web.xml file does not initialized by default. But the container receives
servlets
servlets why do we need web-inf directory in web application  why do we need web-inf directory in web application? means what's the benefits of doing so
Servlets and
Servlets and   Sir...! I want to insert or delete records form oracle based on the value of confirm box can you please give me the idea.... thanks
servlets
which are the differ ways you can communicat between servlets  which are the differ ways you can communicat between servlets   Different ways of communicating between servlets:- 1)Using RequestDispatcher object. 2
servlets
package supports the development of servlets that use the HTTP protocol. The classes... javax.servlet.GenericServlet and serves as the base class for HTTP servlets. HttpServlet-Request
servlets
what are sessions in servlets  what are sessions in servlets   A Session refers to all the request that a single client makes to a server...: http://roseindia.net/jsp/jspsession/ http://www.roseindia.net/servlets
the servlets
what is diff between generic servlets and httpservlets  what is diff between generic servlets and httpservlets   Difference between GenericServlet and HTTPServlet: 1)GenericServlet belongs to javax.servlet package
servlets
regarding the user usage and habits. Servlets sends cookies to the browser client...://www.roseindia.net/jsp/jspcookies.shtml http://www.roseindia.net/servlets/use
servlets
servlets  hi i am using servlets i have a problem in doing an application. in my application i have html form, in which i have to insert on date value, this date value is retrieved as a request parameter in my servlet
servlets
what are filters in java servlets  what are filters in java   Filters are powerful tools in servlet environment. Filters add certain functionality to the servlets apart from processing request and response paradigm
servlets
servlets  what are different authentication options available in servlets   There are four ways of authentication:- HTTP basic authentication HTTP digest authentication HTTPS client authentication Form-based
servlets
servlets  hi i am doing one servlet program in which i strucked at one point. my requirement is after entering the student id it retieves all the information of the student and stores that into a resultset object. now to display
servlets
servlets  how can I run java servlet thread safety program using tomcat server? please give me a step by step procedure to run the following program my program is A DEMO PROGRAM FOR THREAD SAFETY. package serv; import
Servlets
Servlets  when i am compiling the following servlet program it compiles the successfully.but when i try to run the program it gives the following error. Exception in thread "main" java.lang.NoSuchMethodError: main Here
Servlets
Servlets  when i am compiling the follow program it gives the error.so help me to resolve the problem import java.io.*; import javax.Servlet.... it correct program to insert and update the database table record   We
Servlets
Servlets  when i deployed the following servlet program in tomcat i get the following errors description The server encountered an internal error () that prevented it from fulfilling this request. exception
SERVLETS
(); } } } Errors are: C:\Program Files\Apache Software Foundation\Tomcat 6.0
Simple program to combine all html,ajax,java,servlets,jsp,json - Java Beginners
Simple program to combine all html,ajax,java,servlets,jsp,json  Hi, I learned Java,servlets,jsp basics, html, ajax, json and css. I want to do a program which is a combination of all those technology. For that, i planned
jsp -servlets
jsp -servlets  i have servlets s1 in this servlets i have created emplooyee object, other servlets is s2, then how can we find employee information in s2 servlets
Servlets Programming
Servlets Programming  Hi this is tanu, This is a code for knowing... to know how we can make a program on counter which will keep track //how many... visit the following links: http://www.roseindia.net/servlets
Servlets with Extjs
Servlets with Extjs  how to integrate servlets and extjs and also show database records in extjs grid using servlet how to get servlets json response. Can any one please help me
Authentication in Servlets
Authentication in Servlets  What are different Authentication options available in Servlets
advantages of Servlets
advantages of Servlets  What is advantages of Servlets ?    Portability. Powerful. Efficiency. Safety. Integration. Extensibilty. Inexpensive
java servlets
java servlets  please help... how to connect java servlets with mysql i am using apache tomcat 5.5
servlets and struts
servlets and struts  wat is the diffrence between servlets and struts?   A Servlet is a technology and Struts is a framework which relies on or makes use of Servlets.A Servlet is a controller. Struts has its own Servlet
servlets - Servlet Interview Questions
what is servlets in Java  what is servlets in Java
program
program  any program of hotel or school management
program
program  program of jdbc using ms access for creating table
program
program  write a html program in show table and this word in box
program
program  write a program different between to dates in terms of days in java
program
program  write a javascript program to create a application form with validation
how to execute jsp and servlets with eclipse
how to execute jsp and servlets with eclipse  hi kindly tell me how to execute jsp or servlets with the help of eclipse with some small program
program
program  WAP a java program to form 1/2+3/4+5/6+7/8 series
program
program   Write a program to find the difference between sum of the squares and the square of the sums of n numbers
program
program  write a program reversee a string. input-hi this is roseindia output-roseindia is this hi
program
program  develop a servlet to insert the data in the database from our program in the table stored in the database
program
program   An old-style movie theater has a simple profit program. Each customer pays $5 per ticket. Every performance costs the theater $20, plus $.50 per attendee. Develop the program calculateTotalProfit that consumes
program
program  write a java program to input a no. and print wheather the no. is a special no or not. (special no. are those no whose factorial of the sum of digit of the no is same as the original
program
program  Develop the program calculateCylinderArea, which accepts radius of the cylinder's base disk and its height and computes surface area of the cylinder

Ads