This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft on-line!
See this thread for details.
The moose likes JDBC and the fly likes Not able to Inserting integer data Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Not able to Inserting integer data" Watch "Not able to Inserting integer data" New topic
Author

Not able to Inserting integer data

Ahesanali Khanusiya
Greenhorn

Joined: Jul 15, 2010
Posts: 11
I want insert integer data in database but i am not able to do this... i am attaching my whole application

another database connectivity file is
Darryl Burke
Bartender

Joined: May 03, 2008
Posts: 4523
    
    5

And what makes that a Swing / AWT / SWT / JFace question?


luck, db
There are no new questions, but there may be new answers.
Tom Reilly
Rancher

Joined: Jun 01, 2010
Posts: 618
A few suggestions:
1. In the code, print the query string and try running that from mysql. If you don't realize the error from doing that:
2. Post the query string
3. Post the error you are getting
4. Post the database table format
5. A guess: strings need to be wrapped in quotes. Numbers do not
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19552
    
  16

I'll move this to our JDBC forum since the problem is more likely database related.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Ahesanali Khanusiya
Greenhorn

Joined: Jul 15, 2010
Posts: 11
query string is:


table format is:



Exception is: java.lang.NumberFormatException: For input string: "123456789"
Tom Reilly
Rancher

Joined: Jun 01, 2010
Posts: 618
I meant adding System.out.println(query) and post the results of that statement. What were the results of my first suggestion? Also, please post the full error that points at the offending line of code.
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19552
    
  16

Why are those quotes part of the number you're parsing? You're not parsing 123456789 into an int but "123456789". The parsing can't handle those quotes.
Ahesanali Khanusiya
Greenhorn

Joined: Jul 15, 2010
Posts: 11
I am not passing that values but I am insert that value in my swing component of text field by user its not static variable.
Gurunath Kale
Greenhorn

Joined: Jul 08, 2007
Posts: 14
1. Convert the age and all integer type text value into 'int'
for example...

2. In query remove ''' Quotes around the int type datatype


░▒▒▓ ĞŨЯŨ ▓▒▒░
Back To Make Things Better
SCJP
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Not able to Inserting integer data
 
Similar Threads
Can't Update Record ?
Adding Record Problem in JDBC ?
Creating and opening a window if the button is clicked in an applet
Some guidance with a Bank System
not showing JLabel and TextField