查询数据库注意点:
public ResultSet getAddress(Connection con,Address address) throws Exception{ StringBuffer sb = new StringBuffer("select * from list"); if(StringUtil.isNotNull(address.getAddlocal())){ sb.append(" and address like BINARY '%"+ address.getAddlocal()+"%'"); }else{ return null; } PreparedStatement pstmt = con.prepareStatement(sb.toString().replaceFirst("and", "where")); return pstmt.executeQuery(); }
注意:如果是模糊查询日文或者中文不出来的时候 like 后面加上 BINARY
我学习JAVA的母校