错误提示:
Exception in thread "main" com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'like '浙江省,杭州市,西湖区,%' order by mid limit 0,100' at line 1
数据库连接语句
sqlstr = "select locate,content from " +
tableName
+ "where
locate like ? order by mid limit 0,100;";
// orders order by mid
stmt = con.prepareStatement(sqlstr);
String location = "浙江省,杭州市,西湖区,%";
stmt.setString(1,location);
rs =
stmt.executeQuery();
修改
sqlstr = "select locate,content from
tweettrain where
locate like ? order by mid limit 0,100;";
这样就可以了,或者变量通过setString来定义
326

被折叠的 条评论
为什么被折叠?



