aspose file tools*
The moose likes JDBC and the fly likes inserting data into DB Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "inserting data into DB" Watch "inserting data into DB" New topic
Author

inserting data into DB

neelima mullapudi
Greenhorn

Joined: May 09, 2012
Posts: 10
when i use this code data is not getting inserted into the data base




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

thank q in advance
Wendy Gibbons
Bartender

Joined: Oct 21, 2008
Posts: 1107

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

Joined: Jan 10, 2002
Posts: 61648
    
  67

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.

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Raj Java Raj
Greenhorn

Joined: May 14, 2012
Posts: 5

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

Joined: Jan 29, 2007
Posts: 313

What is the error you are getting?


Palak Mathur | My Blog | TechJaunt | What is JavaRanch? | List of All FAQs
Habeeb Shaikh
Ranch Hand

Joined: Nov 23, 2008
Posts: 48
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

Joined: Jun 05, 2010
Posts: 622
Please post the error with your problems. It will be easier for us to have an eye on the problem.


kunal
Prashant Chindhade
Ranch Hand

Joined: Jan 19, 2011
Posts: 77
start index with 0 not 1. try this.
Palak Mathur
Ranch Hand

Joined: Jan 29, 2007
Posts: 313

prashant chindhade wrote:start index with 0 not 1. try this.


Index would start from 1 only.
Kunal Lakhani
Ranch Hand

Joined: Jun 05, 2010
Posts: 622
Palak is right.

In PreparedStatement Index starts from 1 only
Wendy Gibbons
Bartender

Joined: Oct 21, 2008
Posts: 1107

janice garcia,
Your post was moved to a new topic.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: inserting data into DB