查询数据库是否支持游标回滚操作
try {
DatabaseMetaData dmd = connection.getMetaData();
if (dmd.supportsResultSetType(ResultSet.TYPE_SCROLL_INSENSITIVE)) {
// Insensitive scrollable result sets are supported
}
if (dmd.supportsResultSetType(ResultSet.TYPE_SCROLL_SENSITIVE)) {
// Sensitive scrollable result sets are supported
}
if (!dmd.supportsResultSetType(ResultSet.TYPE_SCROLL_INSENSITIVE)
&& !dmd.supportsResultSetType(ResultSet.TYPE_SCROLL_SENSITIVE)) {
// Updatable result sets are not supported
}
} catch (SQLException e) {
}
创建一个回滚得数据结果集
try {
// Create an insensitive scrollable result set
Statement stmt = connection.createStatement(
ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);
// Create a sensitive scrollable result set
stmt = connection.createStatement(
ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_READ_ONLY);
} catch (SQLException e) {
}
查询一个数据结果集的回滚类型
<