Solved

Insert statement in Servlet JDBC program

Posted on 2004-03-21
3
4,628 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
update statement in oracle 9 53
Shared Service Environment 2 55
oracle sql developer + get hour from datetime field 2 26
tablespace - increase the size 2 18
Background In several of the companies I have worked for, I noticed that corporate reporting is off loaded from the production database and done mainly on a clone database which needs to be kept up to date daily by various means, be it a logical…
This post first appeared at Oracleinaction  (http://oracleinaction.com/undo-and-redo-in-oracle/)by Anju Garg (Myself). I  will demonstrate that undo for DML’s is stored both in undo tablespace and online redo logs. Then, we will analyze the reaso…
Via a live example, show how to restore a database from backup after a simulated disk failure using RMAN.
This video shows how to copy an entire tablespace from one database to another database using Transportable Tablespace functionality.

752 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