Hi Vishal. Welcome to the Ranch!
There are some quality issues with your example. I'm not going through all of them.
You close the resources on multiple places in a method. This is best done in a finaly block.
Your code is pone to
sql injection. Try using a PreparedStatement.
You use "if(rs == null)" to check if a table is empty. An executeQuery() will return a ResultSet even if the table is empty.
Regards, Jan