Skip to content

Conversation

@yasassri
Copy link
Contributor

@yasassri yasassri commented Jun 5, 2025

The current ResultSet does not need to be retained at this point since it will be empty. If a ResultSet were found, the loop would break immediately. Passing Statement.KEEP_CURRENT_RESULT to stmt.getMoreResults() causes the following error in MSSQL:

Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: This operation is not supported.
	at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDriverError(SQLServerException.java:248)
	at com.microsoft.sqlserver.jdbc.SQLServerException.throwNotSupportedException(SQLServerException.java:442)
	at com.microsoft.sqlserver.jdbc.SQLServerStatement.getMoreResults(SQLServerStatement.java:2398)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:569)
	at org.apache.tomcat.jdbc.pool.StatementFacade$StatementProxy.invoke(StatementFacade.java:118)
	at jdk.proxy7/jdk.proxy7.$Proxy46.getMoreResults(Unknown Source)
	at org.wso2.micro.integrator.dataservices.core.description.query.SQLQuery.getFirstRSOfStoredProc(SQLQuery.java:1088)
	at org.wso2.micro.integrator.dataservices.core.description.query.SQLQuery.processPreStoredProcQuery(SQLQuery.java:956)
	... 21 more

There is no need to retain the current ResultSet as at this point it will be empty. Because if we find a Resultset we would break out of the loop. This parameter caused following error in MSSQL.

```
Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: This operation is not supported.
	at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDriverError(SQLServerException.java:248)
	at com.microsoft.sqlserver.jdbc.SQLServerException.throwNotSupportedException(SQLServerException.java:442)
	at com.microsoft.sqlserver.jdbc.SQLServerStatement.getMoreResults(SQLServerStatement.java:2398)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:569)
	at org.apache.tomcat.jdbc.pool.StatementFacade$StatementProxy.invoke(StatementFacade.java:118)
	at jdk.proxy7/jdk.proxy7.$Proxy46.getMoreResults(Unknown Source)
	at org.wso2.micro.integrator.dataservices.core.description.query.SQLQuery.getFirstRSOfStoredProc(SQLQuery.java:1088)
	at org.wso2.micro.integrator.dataservices.core.description.query.SQLQuery.processPreStoredProcQuery(SQLQuery.java:956)
	... 21 more
```
@yasassri yasassri requested a review from rosensilva as a code owner June 5, 2025 15:00
@CLAassistant
Copy link

CLAassistant commented Jun 5, 2025

CLA assistant check
All committers have signed the CLA.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants