pgjdbc/pgjdbc GitHub issues and pull requests (mirror)
help / color / mirror / Atom feedFrom: davecramer (@davecramer) <[email protected]>
To: pgjdbc/pgjdbc <[email protected]>
Subject: Re: [pgjdbc/pgjdbc] issue #2656: Adaptive Fetch doesn't enable ResultSet streaming
Date: Mon, 31 Oct 2022 18:03:15 +0000
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>
References: <[email protected]>
I tested the following code and it appears to work (note this is groovy, but add semicolons and it should compile)
```
class TestFetchSize {
public static void main(String[] args)
{
Properties properties = new Properties()
properties.setProperty(PGProperty.USER.getName(),"test")
properties.setProperty(PGProperty.PASSWORD.getName(),"password")
properties.setProperty(PGProperty.LOGGER_LEVEL.getName(), "TRACE")
properties.setProperty(PGProperty.PREFER_QUERY_MODE.getName(),"extended")
PGProperty.ADAPTIVE_FETCH.set(properties, true);
DriverManager.setLogWriter(new PrintWriter(System.err));
Connection con = DriverManager.getConnection('jdbc:postgresql://localhost:5432/test',properties)
con.setAutoCommit(false)
Statement stmt = con.createStatement(); //ResultSet.TYPE_FORWARD_ONLY,ResultSet.CONCUR_READ_ONLY)
stmt.setFetchSize(10)
ResultSet rs = stmt.executeQuery('select * from fetchrows')
while (rs.next())
{
rs.getInt('id')
}
con.commit()
con.close()
}
}
```
I tested this code and it does actually use cursors.
Can you share your code ?
view thread (12+ messages) latest in thread
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: github://pgjdbc/pgjdbc
Cc: [email protected], [email protected]
Subject: Re: [pgjdbc/pgjdbc] issue #2656: Adaptive Fetch doesn't enable ResultSet streaming
In-Reply-To: <<[email protected]>>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox