jacky jacky - 1 year ago 149
Java Question

Getting MySql command result in servlet java

Basically I am trying to find how many people in mysql database are registered by a specific name using

command with my java program. The command executes without any error but the result is something different than I have in my db.

Here is my java code I am using to get UIDs:

public void usernameAvail_fun(){
String query = "SELECT UID FROM db.tb WHERE UFN=\"myuid\"";
ResultSet ursa;
try {
ursa = st.executeQuery(query);
} catch (SQLException e) {

and i happen to get the result as:

Answer Source

You are printing a java object so output is there. If you want to print uid use following statement -

while (ursa.next()){
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download