You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Chen, Dean (Zhun)" <De...@gs.com> on 2002/05/09 18:37:00 UTC
beginner JDBC questions
Hi,
I'm pretty new to JDBC. This email might seem to be a little off topic, but
the people on this list is very knowledgeable, so may be someone can help.
Thanks in advance.
I found the following code on jGuru, I have some questions:
1. Does a JDBC Statement keep it's connection alive with the database when
it's being iterated, like in the below case?
Does this matter if the connection is a pooled connection or not?
2. Are there any documents that describes the inner workings of JDBC
Statement besides the API?
For example: in the below situation, does stmt store all of the
stored proc results in the stmt instance or does it maintain a link to the
results in the database?
If the stored proc returns a large number of rows, would that cause
stmt to throw out of memory errors?
When ResultSet is iterated over stmt, does it get the data from
memory (from stmt?) or make more calls to the database (ie: via cursors?)?
3. For Statement has setFetchSize(int rows), however, after one fetches the
1st 100 rows for example, is there a way to fetch the next 100?
Thanks,
*********** CODE ****************************
boolean result = stmt.execute(" ... ");
int updateCount = stmt.getUpdateCount();
while (result || (updateCount != -1)) {
if(result) {
ResultSet r = stmt.getResultSet();
// process result set
} else if(updateCount != -1) {
// process update count
}
result = stmt.getMoreResults();
updateCount = stmt.getUpdateCount();
}
Dean Chen
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>