Solved

Insert statement in Servlet JDBC program

Posted on 2004-03-21
3
4,635 Views
Last Modified: 2012-08-14
Hi,
I am new to oracle 9i on Windows.I have written a  Servlet program which uses  JDBC for insertion data in table maintained in Oralce Database.The query statements (like SELECT )  are running fine.But I encountered problem in Insert Statement  in table created from command prompt. My code statement is:-
HttpServletRequest req;String Name,Email;
Connection c;

Name=req.getParameter("Name");
Email=req.getParameter("Email");

Statement s=c.createStatement();
s.executeUpdate("INSERT INTO Table VALUES('"+Name+"','"+Email+"');");

I am getting Email and Name variable in browser but insertion is not taking place.
Insertion query is I think the syntax of query is correct.
0
Comment
Question by:aayush123
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 4

Accepted Solution

by:
barthdev earned 75 total points
ID: 10644093
If queries are working, I'll assume that your servlet has a valid Connection. (You do use an initialized Connection object in this method, yes?)

I notice four things that might be easily overlooked by someone that is new to database programming.

1) Is the table name actually "TABLE"?
2) Does the table only have two fields?
3) Is the table in the same schema as your Connection object?

To continue with debugging:

1) What value is returned from the executeUpdate?
2) Or, what SQLException is thrown?
0

Featured Post

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Working with Network Access Control Lists in Oracle 11g (part 1) Part 2: http://www.e-e.com/A_9074.html So, you upgraded to a shiny new 11g database and all of a sudden every program that used UTL_MAIL, UTL_SMTP, UTL_TCP, UTL_HTTP or any oth…
When it comes to protecting Oracle Database servers and systems, there are a ton of myths out there. Here are the most common.
This video explains at a high level with the mandatory Oracle Memory processes are as well as touching on some of the more common optional ones.
This video shows how to Export data from an Oracle database using the Datapump Export Utility.  The corresponding Datapump Import utility is also discussed and demonstrated.
Suggested Courses

630 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question