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

Regression - Stored procedure can't be executed - "Parameter {...} was not defined for stored procedure" #2063

Closed
JackPGreen opened this issue Feb 2, 2023 · 2 comments
Labels
Bug A bug in the driver. A high priority item that one can expect to be addressed quickly.
Projects
Milestone

Comments

@JackPGreen
Copy link

Driver version

12.2.0.jre11

SQL Server version

Microsoft Azure SQL Edge Developer (RTM) - 15.0.2000.1565 (ARM64) Jun 14 2022 00:37:12 Copyright (C) 2019 Microsoft Corporation Linux (Ubuntu 18.04.6 LTS aarch64)

Client Operating System

Mac OSX

JAVA/JVM version

org.eclipse.justj.openjdk.hotspot.jre.full.macosx.aarch64_17.0.2.v20220201-1208

Problem description

After upgrading from 11.2.1 to 12.2.0, when executing a stored procedure we get Parameter {...} was not defined for stored procedure.
This affects multiple different OS and database versions.

From debugging the source code this looks to have been introduced in #1898.

In com.microsoft.sqlserver.jdbc.SQLServerCallableStatement.findColumn(String), a metaQuery is constructed to get information on the stored procedures' columns.

In both 11.2.1 & 12.2.0, the metaQuery returns no results.

The following section then attempts to get a position from map - if parameterNames was null, previously it would return a value (the next increment of ai) - whereas now it will only do this if parameterNames is non-null and has exactly one element.

Therefore no results are returned, and the query fails.

You can probably see this change more clearly here - fa48f7c

@tkyc
Copy link
Member

tkyc commented Feb 2, 2023

Hi, could you share an example stored procedure that reproduces the error. I was wrong in assuming metaQuery should always have a result.

@JackPGreen
Copy link
Author

Hi, could you share an example stored procedure that reproduces the error. I was wrong in assuming metaQuery should always have a result.

Sorry, unfortunately I'm not able to share a minimal example of the stored procedure.

I did run the generated metaQuery on the database itself and got no results their either if it helps.

@lilgreenbird lilgreenbird added the Bug A bug in the driver. A high priority item that one can expect to be addressed quickly. label Feb 2, 2023
@lilgreenbird lilgreenbird added this to Under Investigation in MSSQL JDBC via automation Feb 2, 2023
@lilgreenbird lilgreenbird added this to the 12.3.0 milestone Feb 2, 2023
@tkyc tkyc closed this as completed Feb 16, 2023
MSSQL JDBC automation moved this from Under Investigation to Closed Issues Feb 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug A bug in the driver. A high priority item that one can expect to be addressed quickly.
Projects
MSSQL JDBC
  
Closed Issues
Development

No branches or pull requests

3 participants