• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

not able to get the values from resultset in the variables

 
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,

i am able to compile my code but not getting the database values in the variable my code is not printing values after while loop please help i am not able to resolve this error
kindly find below my code



this is my stack log report

 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There's much extraneous code here that doesn't seem to have anything to do with the problem (all that timer, servlet and mail stuff). If this was my problem I'd write a standalone app that performs nothing but the DB access, and only once I got that working would I run it in a servlet container - much easier to run and debug.

It looks like the DB returns no results. What does the query return if you execute it directly giants the DB (using whatever tools Oracle has with this purpose, or some generic JDBC client)? If you haven't tried that, start with that.
 
Marshal
Posts: 28193
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It would also help if you indented your code consistently. As it is, it's very hard to understand what happens when in what order.

However it looks like there's some code which tries to compare two dates. And it looks like one of the dates is formatted using this:



This is going to produce something like "9-Jan-2014" or "17-Feb-2014". If you do a string comparison on those two you will find that "17-Feb-2014" comes before "9-Jan-2014". On the other hand the other date appears to be formatted by the database so there's no telling whether it looks like that or like "20140301". You should use Date objects in this comparison, not String objects.

Also your database query looks like it might select a lot of database records, but your while-loop only saves data from the last record. Was that intentional, or do you just expect the query to return one record?
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic