ResultSet rs=st.executeQuery("select * from user_data");
connection is successful but I want to count record from user_data.
user_data has records but still I am not able to go inside while loop.
Thanks in advance
Methods "createStatement", "executeQuery" and "next" all throw "SQLException".
This is a checked exception which means your code must handle it.
As Scott implied in his reply to you, perhaps you are catching the "SQLException" but not doing anything with it?
I suggest you post your exception handling code as well.
If you are certain no exceptions are being thrown, then the only conclusion is that your query returns no rows.
In my experience, these are the only two reasons that the "while" loop in your code is not being executed.
Vaishali Paramane wrote:
1.get jdbc connection
2.i think you got problem in while loop na..
you have table shoud be created in data base.then only retriveing is posssible ok.
3 in your code you can not retrive any details regarding fields in the database table
you shoud put after incrementation only you get the count earlier you put before incrementation ok..
you got it .....