craftleft.gif (3002 bytes)QuickTable
Home | API | Tutorial | Download | Support | Contact topblack.gif (108 bytes)


QuickTable User Cp  |  Register  |  Members  |  Search  |  Help
    |- QuickTable Discussion Forums > JDBC/Database Issues Post New Topic   Post A Reply
Postgresql and cursor based result sets printer friendly version
next newest post | next oldest post
Author Messages
per.halvor
Private

Gender: Unspecified
Location:
Registered: Jun 2012
Status: Offline
Posts: 1

Click here to see the profile for per.halvor Send email to per.halvor Send private message to per.halvor Find more posts by per.halvor Edit or delete this message Reply w/Quote
Posted Tuesday, June 12, 2012 @ 07:03:38  

Hi

We are migrating a swing application using quicktable from Oracle to Postgresql (9.1) and have encountered one great obstacle: We are not able to use cursor based result sets (fetch on demand). This means that the whole table is loaded into memory on dbTable.refresh().

In Postgresql, as far as I know, the only way to use cursor based result sets with jdbc is to set autocommit to false (so that the select can be in a transaction) and set fetchsize for the statement to > 0 (fetchsize 0 which is the default, means that all rows are loaded). E.g:

// make sure autocommit is off
conn.setAutoCommit(false);
Statement st = conn.createStatement();

// Turn use of the cursor on.
st.setFetchSize(50);
ResultSet rs = st.executeQuery("SELECT * FROM mytable");
if (rs.next()) {
System.out.print("a row was returned.");
}
rs.close();

Setting autocommit to false for dbtable is easy. My problem is that I can find no way to set fetchsize for the select statement that Quicktable executes, so that when we load a big table, e.g. 250 000 rows, all rows are loaded resulting in very high memory usage. Our users normally opens many such result sets in a session.

Does anyone know a solution to this?

Thanks for your time,
Per Halvor

Admin
Board Owner

Gender: Unspecified
Location:
Registered: Jul 2003
Status: Offline
Posts: 9

Click here to see the profile for Admin Send email to Admin Send private message to Admin Find more posts by Admin Edit or delete this message Reply w/Quote
Posted Saturday, July 14, 2012 @ 06:58:59  

Sorry for the late response. Currently you are setting the select sql to load the data, instead you can handle the connection, statement etc yourself and create a resultset and use that as the source of the data for dbtable. This way you will have full control.

Otherwise, you can also download the opensource code and make the changes as needed and use it.

Post New Topic   Post A Reply Jump to:
Contact Us | QuickTable - A Java DBGrid | Privacy Policy All times are GMT -5 Hours.
Welcome to QuickTable Forums, Guest!  
Login
Username :
Password :
In order to fully utilize the abilities of this board, you are required to register as a member. Registration is free, and allows you to do lots of things including turning on or off certain features of this board. Register now!
Powered by CuteCast v2.0 BETA 2
Copyright © 2001-2003 ArtsCore Studios