I am trying the method of this interface explained here in this tutorial:
Here I go:
DatabaseMetaData dm = con.getMetaData();
System.err.println(dm.supportsResultSetType(ResultSet.TYPE_SCROLL_SENSITIVE));
I know it supports the TYPE_SCROLL_SENSITIVE
type. as I am using it and it works. However the method above reported returns false. Have you ever tried using this method? If yes does it work properly? Thanks in advance.
PS: The same happens with the other 2 types of ResultSets ( TYPE_SCROLL_INSENSITIVE
and TYPE_FORWARD_ONLY
). Considering that TYPE_FORWARD_ONLY
is the default type it's a little bit strange that I get false
in all three cases. UPDATE: I am using JDBC-Mysql drivers;
The implementation in MySQL Connector/J 5.1.21 is:
public boolean supportsResultSetType(int type) throws SQLException {
return (type == ResultSet.TYPE_SCROLL_INSENSITIVE);
}
However a quick look at the rest of the implementation suggests that MySQL also supports the other types.
Assuming you mean the Connector/J driver (there is more than one JDBC driver for MySQL), from the MySQL Connector/J JDBC implementation notes :
Since TYPE_SCROLL_SENSITIVE
, TYPE_SCROLL_INSENSITIVE
, and TYPE_FORWARD_ONLY
usually indicate cursor types, then the statement that the driver doesn't even attempt to emulate them may explain why supportsResultSetType(...)
returns FALSE for all values. With the default behavior of holding the entire result set in memory, forward-only or scrolling modes would be irrelevant.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.