the rowCount variable is not necessary . you are performing two loops on the rs . only the second loop is necessary to get the number of rows which is done by this part of code:
while (rs.next()){
typeID=rs.getInt(1); //typeID is the number of rows in the ResultSet
}