• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Not able to Inserting integer data

 
Ahesanali Khanusiya
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 5125
11
Java Netbeans IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And what makes that a Swing / AWT / SWT / JFace question?
 
Tom Reilly
Rancher
Posts: 618
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 20512
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'll move this to our JDBC forum since the problem is more likely database related.
 
Ahesanali Khanusiya
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
query string is:


table format is:



Exception is: java.lang.NumberFormatException: For input string: "123456789"
 
Tom Reilly
Rancher
Posts: 618
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 20512
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1. Convert the age and all integer type text value into 'int'
for example...

2. In query remove ''' Quotes around the int type datatype
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic