• 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
  • Ron McLeod
  • Tim Cooke
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Jeanne Boyarsky
Saloon Keepers:
  • Stephan van Hulst
  • Carey Brown
  • Tim Holloway
  • Piet Souris
Bartenders:

IllegalStateException while querying database

 
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Guys, I was trying to fetch my Database. If I fetch the database sequecially it will work fine,

This is Sequencially of fetching my Database..and It work fine



But I only need or want to fetch two or more column in the database...And It display some error(The Error is below this codes)



The Error it display......



Please Help me!
 
Bartender
Posts: 7488
171
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In the future, please give your posts more descriptive titles than "Android" or "Android Studio" - in the Android forum, this tells us nothing about what the discussion is all about. I have changed it to something more meaningful - please do so yourself next time.
 
Olajire Abdullahi
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks @Tim Moores
 
Marshal
Posts: 77546
372
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What does it say about moving from row to row in your result set? How many columns do you have?
Who on earth taught you to indent code like that?
You may only need to use the identifier buffer once.
Have you been instructed to use the LF character? If not, don't use \n. Use System.lineSeparator() instead. Why are you using ...+ " " +...? You could simply put the additional space in the preceding String literal. If you are using a StringBuilder, you would probably do better to use multiple append() calls than use +.
 
Olajire Abdullahi
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Campbell Ritchie.
Have make some changes to the code but it doesn't display any error when moving from one row to another..but it display error when it reach index of 7...
I have 8 columns. i.e from 0 - 7
 
Campbell Ritchie
Marshal
Posts: 77546
372
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Olajire Abdullahi wrote:Thanks Campbell Ritchie.

That's a pleasure

. . .I have 8 columns. i.e from 0 - 7

No, you have eight columns numbered 1...8. Databases use different numbering.

You are getting things out of a result set, aren't you? If not, then I am mistaken about 1...8.
 
Rancher
Posts: 4801
50
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What is the query you are using?
 
It's weird that we cook bacon and bake cookies. Eat this tiny ad:
The Low Tech Laboratory Movie Kickstarter is LIVE NOW!
https://www.kickstarter.com/projects/paulwheaton/low-tech
reply
    Bookmark Topic Watch Topic
  • New Topic