Try:
String st="SELECT name FROM mytable WHERE name LIKE '%john %'";
You can do it all in one:
String st="SELECT COUNT(*) FROM mytable WHERE name LIKE '%john %'";
String st="SELECT COUNT(*) FROM mytable WHERE name LIKE '%john %'"
ResultSet rs = stmt.executeQuery(st);
int icount = 0;
while (rs.next) {
icount = rs.getInt(1);
}
jtext1.setText(String.valueOf(icount));
There should only be 1 record with 1 field in the above which will be the count of records matching.
Put a space after john so as not to get names like johnathan etc. but you can play around.