Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa JSP-Servlet Servlets Program
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


Nitish Kumar
Servlets Program
0 Answer(s)      3 years and 8 months ago
Posted in : JSP-Servlet


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.


Advertisement
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  what is the duties of response object in servlets
Advertisements
servlets
servlets  why we are using 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
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
. Anyways, please visit the following links: http://www.roseindia.net/servlets/introductiontoconfigrationservlet.shtml http://www.roseindia.net/servlets
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 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
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
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  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  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  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
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
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
 

 

 

DMCA.com