-
Notifications
You must be signed in to change notification settings - Fork 459
Description
Driver version
com.microsoft.sqlserver:mssql-jdbc:9.2.1.jre8
SQL Server version
Microsoft SQL Server 2019
Client Operating System
Window
JAVA/JVM version
version "11.0.3"
Table schema
Executing stored procedures ("db2.dbo.testSP");
Problem description
connection string - jdbc:sqlserver://dbserver;databaseName=db1
Connect to the database db1 using the JDBC driver.
Stored Procedure of another database (db2) having arguments (Present in same SQL instance).
When we trying to executed stored procedure other database using name parameters it throws an error "The database name component of the object qualifier must be the name of the current database."
The error throws from method setString(String parameterName, String value) when it try to find column index from parameter name.
findColumn method try to execute stored procedure "exec sp_sproc_columns" at that time it throws the error.
Expected behavior
We would expect the stored procedure successfully execute from other database present in same sql instance.
Actual behavior
it throws the error.
Error message/stack trace
com.microsoft.sqlserver.jdbc.SQLServerException: com.microsoft.sqlserver.jdbc.SQLServerException: The database name component of the object qualifier must be the name of the current database.
at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDriverError(SQLServerException.java:234)
at com.microsoft.sqlserver.jdbc.SQLServerCallableStatement.findColumn(SQLServerCallableStatement.java:1340)
at com.microsoft.sqlserver.jdbc.SQLServerCallableStatement.setString(SQLServerCallableStatement.java:1937)
Any other details that can be helpful
Add any other context about the problem here.
JDBC trace logs
Provide the JDBC driver trace logs. Instructions can be found here: https://docs.microsoft.com/sql/connect/jdbc/tracing-driver-operation
Metadata
Metadata
Assignees
Labels
Type
Projects
Status