使用类型_SCROLL u SENSITIVE时出现Java jdbc警告
这是从OCA/OCP Java®SE 7程序员I&;II学习指南(考试1Z0-803和1Z0-804)书籍:
For example, suppose that we mistakenly set the result set type to TYPE_SCROLL_ SENSITIVE when creating a Statement object. This does not create an exception; instead, the database will handle the situation by chaining a SQLWarning to the Connection object and resetting the type to TYPE_FORWARD_ONLY (the default) and continue on.
我不知道为什么设置type_SCROLL_usensitive类型的语句会导致将类型重置为type_FORWARD_ONLY,我是否遗漏了什么
如上所述,此代码将把类型设置回“仅向前”类型
Connection conn =
DriverManager.getConnection("jdbc:derby://localhost:1527/BookSellerDB",
"bookguy", "$3lleR");
Statement stmt =
conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,
ResultSet.CONCUR_UPDATABLE);
String query = "SELECT * from Book WHERE Book.Format = 'Hardcover'";
ResultSet rs = stmt.executeQuery(query);
# 1 楼答案
请看这里:https://docs.oracle.com/cd/A87860_01/doc/java.817/a83724/resltse2.htm#1018253
它接着说:
好的,这些是特定于Oracle数据库的,但它显示了降级的示例