JDBC-Question

Started by Erwin Ambroschabout 24 years ago4 messagesgeneral
Jump to latest
#1Erwin Ambrosch
ambre@ebutec.com

Hi,

I wonder what happens if an application performs the following.

Lets say I have a table named user with 1000 rows. The application executest
the following.

Connection con = getConnterion();
Statement stmt = con.createStatement();
ResultSet rset = stmt.executesQuery("SELECT * FORM users");

Do I have all the data (1000 rows) in memory or dose the driver fetch the
data as needed (while iterating over the rset instance) from my postgresql
backend.

Thanks in advance
Erwin

#2Kris Zawadka
kris@h3x.com
In reply to: Erwin Ambrosch (#1)
Last Inserted row.

I'm sure this must have been covered before but the search engine for
the mailing list is currently down and I couldn't find any help on the
web.

I would like to know if it's possible to return a data set after an
insert. In MS SQL it's quite easy to create a trigger that return's
information about the inserted record such as primary ID and so forth.
Using a Function & Trigger I can return the information with RAISE but
obviously PHP or any other language won't treat that as a row from a
result set.

I wish to perform this task at the trigger/function level for
abstraction reasons and want to avoid having to multiple select
statements for something that should be easily done in one.

Thanks for your help,

Kris Zawadka

#3Marin Dimitrov
marin.dimitrov@sirma.bg
In reply to: Erwin Ambrosch (#1)
Re: [GENERAL] JDBC-Question

Do I have all the data (1000 rows) in memory or dose the driver fetch the
data as needed (while iterating over the rset instance) from my postgresql
backend.

since I would expect that the driver retrieves the result sets in chunks I'd
like to know if this behaviour can be controlled - i.e. is setFetchSize()
implemented?

thanx,

Marin

#4Dave Cramer
pg@fastcrypt.com
In reply to: Marin Dimitrov (#3)
Re: [GENERAL] JDBC-Question

Actually, at the moment the driver gets all the result set at once, so
no setFetchSize() isn't implemented.

However you can get a cursor back and scroll through the result set
yourself

Dave

-----Original Message-----
From: pgsql-jdbc-owner@postgresql.org
[mailto:pgsql-jdbc-owner@postgresql.org] On Behalf Of Marin Dimitrov
Sent: Thursday, March 14, 2002 6:55 AM
To: pgsql-jdbc@postgresql.org
Subject: Re: [JDBC] [GENERAL] JDBC-Question

Do I have all the data (1000 rows) in memory or dose the driver fetch
the data as needed (while iterating over the rset instance) from my
postgresql backend.

since I would expect that the driver retrieves the result sets in chunks
I'd like to know if this behaviour can be controlled - i.e. is
setFetchSize() implemented?

thanx,

Marin

---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster