【发布时间】:2012-03-14 19:48:35
【问题描述】:
我正在制作一个系统来检测用户是否自动捐款。它首先从一个表中获取记录,其中收集的列设置为 0,并且用户名是当前用户的用户名。有一个 items 列,里面是一个 json 编码的数组,其中包含他们应该接收的内容。我需要使用 getArray 函数来获取 json 数组,而不是作为字符串获取。
我收到此错误: java.sql.SQLFeatureNotSupportedException
这是我的代码(如果您发现 json 有问题,请告诉我,无法测试,因为 getArray 不起作用)。
public void checkForDonation(final Player player) throws JSONException {
try {
ResultSet rs = Launcher.getDBC()
.getQuery(
"SELECT * FROM `rewards` WHERE `username`= '"
+ player.getDisplayName()
+ "' AND `completed`='0'");
if (rs.next() == true) {
JSONArray json = new JSONArray();
JSONObject obj = new JSONObject();
try {
obj.put("items", rs.getArray("items"));
} catch (org.json.JSONException e) {
System.err.println(e);
e.printStackTrace();
}
json.put(obj);
System.out.println(json);
}
} catch (SQLException e) {
e.printStackTrace();
}
}
【问题讨论】:
-
8 个问题和 0 个被接受,gl 得到一些帮助你..
-
不相关但可能您应该阅读的内容:owasp.org/index.php/SQL_Injection
-
您使用的是什么数据库,您使用什么数据库驱动程序来访问它? java.sql.SQLFeatureNotSupportedException 表示 jdbc 驱动程序问题