Skip to content

Azure SNI connection through tunnel #312

@csernitamas

Description

@csernitamas

Bug Report

I'm connecting to an Azure MS SQL database through a tunnel. The tunnel forwards the requests from the given port to xxxx.database.windows.net:1433. This connection works fine. I tried it with other application that has jdbc connection configured like this.

I'm trying to use r2dbc-mssql to connect to the database and it fails at the login.
It seems to me that it fails the login because of the localhost servername. (it was the problem with the jdbc connection earlier that I was able to configure it and it fixed the problem similar to this). But I can't find a way to configure it with r2dbc.

Versions

  • Driver: 1.0.4.RELEASE
  • Database: Azure SQL Server
  • Java: 21

Current Behavior

It fails at the login. The log message is: Cannot open server "localhost" requested by the login. The login failed.
My current configuration looks like this:

spring:
  r2dbc:
    url: r2dbc:mssql://localhost:1433/db-name?serverName=server-name.database.windows.net

Stack trace
i.r2dbc.mssql.client.ReactorNettyClient  : [cid: 0x2] Request: Login7 [header=DefaultHeaderOptions [type=TDS7_LOGIN, status=0], tdsVersion=VER_DENALI, packetSize=8000, clientPid=0, connectionId=0, tokens=[LoginRequestToken [tokenType=Hostname], LoginRequestToken [tokenType=Username], LoginRequestToken [tokenType=Password], LoginRequestToken [tokenType=AppName], LoginRequestToken [tokenType=Servername], LoginRequestToken [tokenType=IntName], LoginRequestToken [tokenType=Database]]]
i.r2dbc.mssql.client.ssl.TdsSslHandler   : [cid: 0x2] Write wrapping: Flushing output buffer and enable auto-read
i.r2dbc.mssql.client.ssl.TdsSslHandler   : [cid: 0x3] SSL Handshake done
i.r2dbc.mssql.client.ReactorNettyClient  : [cid: 0x2] Response: ErrorToken [number=40532, state=1, infoClass=20, message='Cannot open server "localhost" requested by the login.  The login failed.", serverName='localhost", procName='", lineNumber=0]
i.r2dbc.mssql.client.ReactorNettyClient  : [cid: 0x2] Warning: Code [40532] Severity [SYSTEM_SQL_PROBLEM]: Cannot open server "localhost" requested by the login.  The login failed.
i.r2dbc.mssql.client.ssl.TdsSslHandler   : [cid: 0x3] Reordering handlers for full SSL usage
i.r2dbc.mssql.client.ReactorNettyClient  : [cid: 0x2] close()
i.r2dbc.mssql.client.ReactorNettyClient  : [cid: 0x3] Response: NEGOTIATED
i.r2dbc.mssql.client.ReactorNettyClient  : [cid: 0x2] close(subscribed)
i.r2dbc.mssql.client.ReactorNettyClient  : [cid: 0x3] Request: Login7 [header=DefaultHeaderOptions [type=TDS7_LOGIN, status=0], tdsVersion=VER_DENALI, packetSize=8000, clientPid=0, connectionId=0, tokens=[LoginRequestToken [tokenType=Hostname], LoginRequestToken [tokenType=Username], LoginRequestToken [tokenType=Password], LoginRequestToken [tokenType=AppName], LoginRequestToken [tokenType=Servername], LoginRequestToken [tokenType=IntName], LoginRequestToken [tokenType=Database]]]
i.r2dbc.mssql.client.ReactorNettyClient  : Exchange cancelled while exchange is active. This is likely a bug leading to unpredictable outcome.
i.r2dbc.mssql.client.ReactorNettyClient  : [cid: 0x2] close()
i.r2dbc.mssql.client.ReactorNettyClient  : [cid: 0x2] close(subscribed)

Expected behavior/code

To be able to use the r2dbc with tunneling to Azure SQL Database.

Possible Solution

I should be able to configure the server name.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions