Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

inserting data into DB

 
neelima mullapudi
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
when i use this code data is not getting inserted into the data base




plzz help me ..............

thank q in advance
 
Wendy Gibbons
Bartender
Posts: 1111
Eclipse IDE Oracle VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am afraid there are a few problems.
If an exception is thrown it just sends you back to the registration page, which is fine but nowhere do you store/show the details of the exception thrown.

This is actually critical information when trying to fix a problem. You need to display the stack trace somewhere somehow.

just saying it doesn't work is useless please read this link and give us some further information.

Why is this in a JSP and not in a servlet please read this link, do not put java in a jsp page
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65225
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
neelima mullapudi wrote:plzz help me ... thank q in advance

Please use real words when posting to the forums. Abbreviations such as "plzz" in place of "please" and "q" in place of "you" only serve to make your posts more difficult to read and less likely to generate useful responses.
 
Raj Java Raj
Greenhorn
Posts: 5
IBM DB2 Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi , Neelima ,
Why dont you use MVC for such critical operation that is dealing with Database?

You can write simple Servlet and Java class that will handle your request.

your data base activity should follow below steps , and if your code is in MVC it will better to track where is actual error is coming and
above to maintain your code will be so easy.

check this simple steps:
 
Palak Mathur
Ranch Hand
Posts: 342
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is the error you are getting?
 
Habeeb Shaikh
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi, I think it is giving error because for 'contno', she might have taken integer type in database and trying to insert string type. She need to use setInteger() method instead of setString().
 
Kunal Lakhani
Ranch Hand
Posts: 622
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please post the error with your problems. It will be easier for us to have an eye on the problem.
 
Prashant Chindhade
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
start index with 0 not 1. try this.
 
Palak Mathur
Ranch Hand
Posts: 342
IntelliJ IDE Java Spring
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
prashant chindhade wrote:start index with 0 not 1. try this.


Index would start from 1 only.
 
Kunal Lakhani
Ranch Hand
Posts: 622
  • Likes 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Palak is right.

In PreparedStatement Index starts from 1 only
 
Wendy Gibbons
Bartender
Posts: 1111
Eclipse IDE Oracle VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
janice garcia,
Your post was moved to a new topic.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic