• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

inserting data into DB

 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Bartender
Posts: 1111
Eclipse IDE Oracle VI Editor
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Sheriff
Posts: 67754
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Greenhorn
Posts: 5
IBM DB2 Oracle Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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:
 
Ranch Hand
Posts: 343
Mac OS X Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What is the error you are getting?
 
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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().
 
Ranch Hand
Posts: 622
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
start index with 0 not 1. try this.
 
Palak Mathur
Ranch Hand
Posts: 343
Mac OS X Spring Java
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Palak is right.

In PreparedStatement Index starts from 1 only
 
Wendy L Gibbons
Bartender
Posts: 1111
Eclipse IDE Oracle VI Editor
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
reply
    Bookmark Topic Watch Topic
  • New Topic