• 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:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • paul wheaton
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
  • Himai Minh
Bartenders:

Not able to Inserting integer data

 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Bartender
Posts: 5167
11
Netbeans IDE Opera Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
And what makes that a Swing / AWT / SWT / JFace question?
 
Rancher
Posts: 618
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Sheriff
Posts: 22850
132
Eclipse IDE Spring Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 22850
132
Eclipse IDE Spring Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic