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

12.6.3 procedure return value regression #2477

Closed
gadamsfd opened this issue Jul 17, 2024 · 5 comments · Fixed by #2480
Closed

12.6.3 procedure return value regression #2477

gadamsfd opened this issue Jul 17, 2024 · 5 comments · Fixed by #2480
Assignees
Milestone

Comments

@gadamsfd
Copy link

gadamsfd commented Jul 17, 2024

Driver version

12.6.3.jre11
Provide the JDBC driver version (e.g. 10.2.0).

SQL Server version

Microsoft SQL Server 2019 (RTM-CU25) (KB5033688) - 15.0.4355.3 (X64)
Jan 30 2024 17:02:22
Copyright (C) 2019 Microsoft Corporation
Developer Edition (64-bit) on Windows Server 2019 Datacenter 10.0 (Build 17763: ) (Hypervisor)

Client Operating System

macos sonoma 14.5

JAVA/JVM version

17.0.11

Table schema

CREATE or alter PROCEDURE dbo.SpReturnTest (
    @Arg1 VARCHAR(128)
)
AS
    SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED
    SET NOCOUNT ON
    SET XACT_ABORT ON

DECLARE
    @ReturnCode INT

    RETURN 1
go

jdbc code

try (Connection con = DriverManager.getConnection("jdbc:sqlserver://redacted;", "redcated", "redacted")) {
            try (CallableStatement cs = con.prepareCall("{? = call dbo.SpReturnTest(@Arg1 = ?)}")) {
                cs.registerOutParameter(1, Types.INTEGER);
                cs.setString(2, "foo");
                cs.execute();
                assertThat(cs.getInt(1)).isEqualTo(1);
            }
        }

Problem description

With 12.6.2, 1 is returned by cs.getInt(1), as expected and appropriate, but with 12.6.3, 0 is returned. Without the second input argument, the problem does not occur, the issue appears to depend on having 2 arguments.

@gadamsfd
Copy link
Author

gadamsfd commented Jul 17, 2024

java0.log.0.tgz
attached trace logs with 12.6.3, broken

@gadamsfd
Copy link
Author

java0.log.0.tgz
attached trace logs with 12.6.2, working

@Jeffery-Wasty
Copy link
Contributor

Jeffery-Wasty commented Jul 17, 2024

This seems similar to #2463. Can you try preview driver 12.7.1 where issue #2463 was fixed?

@gadamsfd
Copy link
Author

@Jeffery-Wasty runtimeOnly("com.microsoft.sqlserver:mssql-jdbc:12.7.1.jre11-preview") still returns 0, when it should return 1.

@Jeffery-Wasty
Copy link
Contributor

Thanks for testing. We'll look into the issue and get back to you with our conclusion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Closed Issues
Development

Successfully merging a pull request may close this issue.

3 participants