Configure Fetchsize for Oracle JDBC datasource in JBoss EAP

Solution Unverified - Updated -

Environment

  • JBoss Enterprise Application Platform (EAP)
    • 4.3
    • 5.x
  • Oracle JDBC datasource

Issue

  • How can I set the Fetchsize on my Oracle JDBC datasource?

Resolution

  • Set the "defaultRowPrefetch" property in *-ds.xml file of datasource.

  • For Non-xa datasource

<connection-property name="defaultRowPrefetch">100</connection-property>
  • For Xa datasource
<xa-datasource-property name="ConnectionProperties">
     defaultRowPrefetch=100
</xa-datasource-property>
  • To be clear, the row-prefetch value is used as the default fetch size in a statement object. Setting the fetch size overrides the row-prefetch setting and affects subsequent queries executed through that statement object.

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.

Comments