ITADN

Inconsistency between rs.getType() and stmt.getResultSetType()

#595Opendwenking 创建于 2023-11-16
D
dwenkingcommented
In the provided test case, a Statement object is created with specific ResultSet type parameters, and a query is executed to obtain a ResultSet. However, the type of the ResultSet as reported by rs.getType() does not match the type specified in the Statement object and returned by stmt.getResultSetType(). ```java @Test public void test() throws SQLException { Connection con; Statement stmt; ResultSet rs; con = DriverManager.getConnection("jdbc:pgsql://localhost:5432/test11?user=user&password=password"); stmt = con.createStatement(1005, 1007, 2); stmt.execute("CREATE TABLE table11_0(id VARCHAR(5) PRIMARY KEY,value BIT);"); rs = stmt.executeQuery("SELECT * FROM table11_0;"); System.out.println(rs.getType()); System.out.println(stmt.getResultSetType()); rs.close(); stmt.close(); con.close(); } ```
0 条评论