• 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

resultset is not working properly

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


I have following code... what is the problem in this it is fetching value only second query




I have value in resident_ele_bill_ref but it is not taking that values...

please tell me what is the wrong in this code...

Thanks
 
Bartender
Posts: 2407
36
Scala Python Oracle Postgres Database Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
One general piece of advice: use bind variables for your query parameters. This is more secure and often more efficient than simply concatenating strings.

As for your queries, why don't you log into your database's SQL interface and run each query manually to see the results?

Once you have confirmed that your queries fetch the correct results, put them in your Java code and see what happens.
 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Rd Dari

In your first Sql Query the first field

society name

is right? check for space between society and name.
 
Rd Dari
Ranch Hand
Posts: 214
Netbeans IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Shiva,

It is the right field its society_name in both of tables........
in actually these are the right queries both but its not showing value of second table .


I am selecting society name in a first page(search_electricity_bill.jsp) using AJAX and you can understand I am giving my all code and table below:---------


my queries is that if the second table (resident_elec_bill_ref)is not having the value according to the society_name then it should showing data from the apppartment table but its only showing data only appartment table .....

This is my first page that working properly to get the society name in a taxt field using AJAX....



and this is the second page which is main page.....



These are the tables ......

So please tell me what is the wrong in this.................

I am very confused I think nothing major problem in this but what is the little bit ?

Thanks for understanding my queries....

 
Rd Dari
Ranch Hand
Posts: 214
Netbeans IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi guy,

I used this code but the problem is same infact only one row is showing .......



servlet is here...



Please help me what is the main problem where....

i need it imidiately..
 
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm not sure if this will solve the problem, but you should call the close() method on a ResultSet object once you're done using it (and before you reassign it).
You may also have to close() the Statement/PreparedStatement.
You should definately close() the Connection object when you're done with it. It's always a good idea to call close() on the connection in the finally-block of a try-catch construct, so that the database Connection is closed even if an exception occurs in the code that uses the Connection.
 
Marshal
Posts: 28175
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
The main problem is that you have way too much code. There are lots of other serious problems, but the most serious problem is that you are
using a test environment which is far too complicated. You don't need a web application to test your database access; put that aside and write a
small Java application which does nothing but test your database code.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic