Re: SelectMethod=cursor and SelectMethod=direct

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Frank Brouwer wrote:
> Hi Joe,
>
> Thanks for the answer.
>
> We use prepared statements only, one per connection and we don't use
> updateable and/or scrollable resultsets. All the database
updates/inserts
> are done by sql using a prepared statement and then setting the field

> parameters. After processing a resultset the prepared statement is
closed
> and the connection is returned to the connection pool, using a
"finally
> block" in the method.
>
> Reading your advice it seems best to switch using direct cursors. My
only
> concern is the memory usage as a direct cursor reads the complete
resultset
> into memory (I asume analyzing profiler output).
>
> Any tips on that issue?

You could try another driver, such as jTDS (disclaimer: I'm a jTDS
developer). As you can see the MS driver either retrieves ResultSets
requesting one row at a time (in cursor mode) or caches the ResultSet
contents into memory (in direct mode). There's no other choice. (jTDS
will not retrieve rows one by one or cache them into memory
unnecessarily.)

There are also quite a few commercial drivers, if you can afford them.
A Google search will get you a complete list.

Alin,
The jTDS Project.

.



Relevant Pages

  • Re: JDBC and ResultSet problem
    ... > Is it not possible to change default read cursors to be server side ... > to switch back to the jTDS driver. ... connection to retrieve a ResultSet and do something else at the same ...
    (comp.lang.java.databases)
  • Re: Datenbank in JTable
    ... static JTable getAllCustomers() { ... ResultSet resultSet = null; ... Connection connection = DAToDB.getConnection; ... catch (SQLException sqlex) { ...
    (de.comp.lang.java)
  • Re: jdbc software architecture design, best practice
    ... anselm - I'm pretty new to Java but I suppose I should try to help whenever ... populate it from my resultset from query. ... execute the queries themselves in different classes. ... connection or the exectuting statement are being closed. ...
    (comp.lang.java.databases)
  • Re: persistent resultsets after connection is closed
    ... > "getMyQueryStuff" that method converts the resultset ... > then can't close your connection pool in the database ... so that connection is now left unreturned to the ... Though I try to design another layer between the business logic and the ...
    (comp.lang.java.programmer)
  • Re: "Too many connections"-Fehler mit MySQL
    ... > SQLException:Data source rejected establishment of connection, ... > das Resultset schliessen. ... Datenbankverbindung hängt meistens ein Socket. ...
    (de.comp.lang.java)