ResultSet rs = null;....try{ String name = rs.getString("NAME");}catch(Exception e){}这样使用通常不会出问题,你的数据库是啥?
用trim函数可以去掉空格trim(字符串)