ITADN

Inconsistent Handling of Invalid setFetchDirection Input between ResultSet and Statement

#596Opendwenking 创建于 2023-11-16
D
dwenkingcommented
When an invalid fetch direction value is passed to setFetchDirection, the ResultSet object accepts it without throwing an exception, whereas the Statement object correctly throws a SQLException for the same invalid input. ```java @Test public void test() throws SQLException { Connection con = DriverManager.getConnection("jdbc:postgresql://localhost:5432/test11?user=user&password=password"); Statement stmt = con.createStatement(); ResultSet rs = stmt.getGeneratedKeys(); rs.setFetchDirection(425635067); // succeed System.out.println(rs.getFetchDirection()); stmt.setFetchDirection(425635067); // java.sql.SQLException: Illegal argument } ```
0 条评论