strongduanmu opened a new issue #14827:
URL: https://github.com/apache/shardingsphere/issues/14827


   When I investigate stream resultset not close exception in PR#14822, I found 
that this exception did not occur in JDBC adaptor, and Proxy adaptor had an 
exception that the streaming result set was not closed. 
   
   It can be found from source code that in Proxy adaptor, we implement the 
setting of the fetchSize parameter through the 
`StatementMemoryStrictlyFetchSizeSetter` SPI to implement streaming query, but 
the JDBC adaptor lacks similar logic, so streaming query cannot be used.
   
   Proxy adaptor:
   
   ```java
       @Override
       public Statement createStorageResource(final Connection connection, 
final ConnectionMode connectionMode, final StatementOption option) throws 
SQLException {
           Statement result = connection.createStatement();
           if (ConnectionMode.MEMORY_STRICTLY == connectionMode) {
               setFetchSize(result);
           }
           return result;
       }
   ```
   
   JDBC adaptor:
   
   ```java
       @SuppressWarnings("MagicConstant")
       @Override
       public Statement createStorageResource(final Connection connection, 
final ConnectionMode connectionMode, final StatementOption option) throws 
SQLException {
           return connection.createStatement(option.getResultSetType(), 
option.getResultSetConcurrency(), option.getResultSetHoldability());
       }
   ```
   
   In order to reduce the memory usage, we need to perform the same logic on 
the JDBC adaptor.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to