Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TVP Handling is causing exception when calling SP with return value #80

Closed
bergerdenes opened this issue Dec 9, 2016 · 7 comments
Closed
Assignees
Labels
Under Review Used for pull requests under review

Comments

@bergerdenes
Copy link

When the SQLServerCallableStatement is called with prepareCall("{call SPNAME}") and Structured parameter is added to the statement, the call is successful.
However when the caller would need the return value from the call, that is prepareCall("{? = call SPNAME}") is used (with the first parameter placeholder for the return value) and also this is registered with registerOutParameter(1, Types.INTEGER), the execution of the statement fails because the SQLServerParameterMetaData class in the driver tries to get a nonexisting row from the sp_sproc_columns call result (to determine the TVP name from the database with this internal sp call).
The erroneus line is in the SQLServerParameterMetaData.verifyParameterPosition method, when calling the rsProcedureMeta.absolute(param+1). Here the +1 should be checked and added only if there is no return value parameter expected.

@xiangyushawn xiangyushawn added the Under Review Used for pull requests under review label Dec 9, 2016
@xiangyushawn xiangyushawn self-assigned this Dec 9, 2016
@xiangyushawn
Copy link
Contributor

@bergerdenes thank you for filling this issue. We are able to reproduce the issue. Also, at the meantime, please try to use SQLServerCallableStatement.setStructured() and it should work for you. our team will fix the issue as soon as possible. Thank you.

@xiangyushawn
Copy link
Contributor

xiangyushawn commented Dec 9, 2016

@bergerdenes please let us know if the PR #82 works for you. Thank you.

@bergerdenes
Copy link
Author

@v-xiangs I have tried the workaround solution earlier (the explicit setStructured call with passing the TVP name from the database), it worked fine.
From the PR#82 it also seems a pretty good solution, I will try it at my workplace next Monday. Will let you know. Thanks!

@bergerdenes
Copy link
Author

Tried out, works fine!

@xiangyushawn
Copy link
Contributor

@bergerdenes thank you for finding the issue and testing out the fix. I will go ahead and close this issue then, thank you again.

xiangyushawn added a commit that referenced this issue Dec 12, 2016
fix issue TVP Handling is causing exception when calling SP with return value #80
@bergerdenes
Copy link
Author

I also thank you for reacting on it so quickly :)
May I ask in which release and when can we expect an official release that are also published to Maven repositories?

@ajlam
Copy link
Member

ajlam commented Dec 15, 2016

@bergerdenes - We should have another "technical preview" release coming out in early January. We will be uploading that release to Maven as well. Please keep in mind that this will be a "preview" release and not RTW 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Under Review Used for pull requests under review
Projects
None yet
Development

No branches or pull requests

3 participants