How to set Cursor type in JDBC?

Kieveli picture Kieveli · Dec 3, 2008 · Viewed 11k times · Source

I'm running tomcat and have some jsp pages that display a subset of a table. I show 20 rows at a time on a single page. When the table has large amounts of data, the jsp page doesn't render. I'm guessing that the ResultSet is using a client side cursor. I've worked with ASP in the past, and we always used server side forward only cursors, and never had any problems with large amounts of data. Our database is oracle 10g.

How can I specify a server-side forward-only cursor in JDBC?

Answer

Kieveli picture Kieveli · Dec 3, 2008

The oracle driver implements server-side cursors via the FetchSize property.

Unfortunately, JDBC doesn't explicitly allow for setting client vs server-side cursors, so different drivers implement it in different ways. Here are the other links that helped:

Fetch Size
Cursors
Oracle Driver