1

I am using the ojdbc5.jar. First, I am getting DatabaseMetaData from sql connection Then I am calling getProcedureColumns() method on DatabaseMetaData which returns me a resultset. When I print the fetchsize of the resultset, it returns 1. Then, I tried setting this fetchsize using the method setFetchSize() method on the resultset. Again, when I print the fetchSize of the resultset, it prints 1. Why, the setFetchSize() method of the resultset is not working ?

DatabaseMetaData metaData = connection.getMetaData();
ResultSet result = metaData.getProcedureColumns(null,"IFSAPP","DECODE",null);
System.out.println(result.getFetchSize());
result.setFetchSize(100);
System.out.println(result.getFetchSize());

Result of the above code snippet is:
1
1

Mark Rotteveel
  • 100,966
  • 191
  • 140
  • 197
user3086551
  • 405
  • 1
  • 4
  • 13
  • There can be a lot of reasons for that, including - for example - that the database metadata might be cached and therefor it is a disconnected result set that is fully materialized so fetch size would be irrelevant, without in depth knowledge of the implementation of the Oracle JDBC driver it is hard to tell. I suggest you try it with a normal select query instead. – Mark Rotteveel May 26 '16 at 07:59
  • according to this https://docs.oracle.com/cd/B10501_01/java.920/a96654/resltset.htm you have to setBatchSize before running the query. I hope it is possible (checking it...) – ozma May 04 '17 at 08:39
  • Does this answer your question? [Java JDBC ignores setFetchSize?](https://stackoverflow.com/questions/1468036/java-jdbc-ignores-setfetchsize) – Adir Dayan Sep 07 '20 at 19:51

0 Answers0