Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

not able to get the values from resultset in the variables

 
Priyanka Dande
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
  • 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

 
Ulf Dittmer
Rancher
Posts: 42969
73
  • Mark post as helpful
  • send pies
  • 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.
 
Paul Clapham
Sheriff
Posts: 21581
33
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • 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?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic