我不知道我应该如何处理“PreparedStatment 不支持”异常。
我的代码是
connection = connectToDB();
print("Connection Success");
String sql = "Create Table test(id Integer primary key not null," +
"name Varchar(32)," +
"age Integer)";
Statement statement = connection.createStatement();
statement.execute(sql);
print("Created Table");
sql = "Insert into test Values(1, 'Mr.Maeda', 23)";
statement.execute(sql);
print("Inserted Data");
ResultSet result;
sql = "select * from test";
PreparedStatement preStatement = connection.prepareStatement("select * from test where age = ?");
preStatement.setString(1, "23");
result = preStatement.executeQuery(sql);
while(result.next()){
print(result.getString(result.getRow()));
}
我正在使用 eclipse & java。