public String selIP(String ip){ String country ="";//获得地点名称 System.out.print(ip);//ip获取没有问题,假设获得的ip是ip "61.33.4.251" String sql = "SELECT country FROM [ip] where "+ip+" BETWEEN 'startip' AND 'endip'"; PreparedStatement pstmt = null; ResultSet rs = null; try { pstmt = con.prepareStatement(sql);