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

Issue: Connection to Data Warehouse SQL Endpoint in Microsoft Fabric Fails with "Read: EOF" Error #230

Closed
jaume-pladevall-itk opened this issue Dec 4, 2024 · 34 comments

Comments

@jaume-pladevall-itk
Copy link

We implemented a connection to a Data Warehouse SQL endpoint in Microsoft Fabric, but it suddenly stopped working and began returning the error message “Read: EOF” without any changes to our code.
We use the following code to connect to the database:

import (
	"database/sql"
	"fmt"

	"github.com/microsoft/go-mssqldb/azuread"
)

...

connString := fmt.Sprintf("sqlserver://%s?database=%s&fedauth=ActiveDirectoryAzCli&connection+timeout=30", url, database)

db, err := sql.Open(azuread.DriverName, connString)
if err != nil {
    fmt.Println("Error creating connection pool: ", err.Error())
    return
}
defer db.Close()

err = db.Ping()
if err != nil {
    log.Println("Ping failed:", err)    
}

...

The code above returns the error "Ping failed: Read: EOF" where url has the following format: "long_mix_of_numbers_and_chars.datawarehouse.fabric.microsoft.com" and database is the name of the table we want to access inside the Data Warehouse.

We are using Go 1.22.0 and go-mssqldb version v1.7.2.

Upon debugging the go-mssqldb library, it appears that a first connection is established, as it enters the loginAckStruct case (line 1366 of the file tds.go). Then, it enters the condition sess.routedServer != "" (line 1393 of the file tds.go) and initiates another connection, which is the one that returns the "Read: EOF" error.

We also tried connecting to the SQL endpoint using SQL Server Management Studio (SSMS) and directly accessing the Data Warehouse from Microsoft Fabric. Both methods work successfully.

Has anyone else experienced the same issue? If so, could you share your insights or solutions? Additionally, if anyone has any clues as to why this might be happening or how to resolve it, your help would be greatly appreciated. Thank you!

@shueybubbles
Copy link
Collaborator

I think it's due to #226

@shueybubbles
Copy link
Collaborator

@jaume-pladevall-itk could you try building with the latest commit in main (#228 ) and see if it fixes your issue? I'd love a 3rd party validation before I push a 1.8 tag.

@jaume-pladevall-itk
Copy link
Author

@shueybubbles Now with the latest commit in main (#228) it works again. Thank you very much!

@flarco
Copy link

flarco commented Dec 18, 2024

Seems it's still happening when using fedauth=ActiveDirectoryAzCli. Please see slingdata-io/sling-cli#468 (comment)

@shueybubbles
Copy link
Collaborator

@flarco did your sling dev build upgrade go-mssqldb to v1.8?

@flarco
Copy link

flarco commented Dec 18, 2024

Yes, see here: https://github.com/slingdata-io/sling-cli/compare/v1.3.4 (commit eb7ff40)
A dev build is released right after each commit.
FYI @johnoscott can you run with --debug and share the stack trace here?

@shueybubbles
Copy link
Collaborator

FWIW if I use the latest go-sqlcmd based on go-mssqldb I can access a Fabric DW that's in our "daily" environment. I can use both -G and --authentication-method

sqlcmd - S <funkystringofcharacters>datawarehouse.fabric.microsoft.com --authentication-method ActiveDirectoryAzCli
1> select @@version
2> go


------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Microsoft Azure SQL Data Warehouse (RTM) - 12.0.2000.8
        Dec 12 2024 16:54:01
        Copyright (C) 2024 Microsoft Corporation

@johnoscott
Copy link

Here is the output with --debug

❯ ./sling --version                    
Version: 1.3.4.dev (2024-12-17)

 ./sling conns test FABRIC_WH2 --debug
2024-12-19 07:53:22 DBG closed "sqlserver" connection (conn-sqlserver-1L4)
fatal:
--- proc.go:271 main ---
--- sling_cli.go:474 main ---
--- sling_cli.go:510 cliInit ---
--- cli.go:286 CliProcess ---
--- sling_conns.go:180 processConns ---
--- connection_local.go:64 Test ---
~ could not test FABRIC_WH2
--- connection_discover.go:24 Test ---
~ could not connect to FABRIC_WH2
--- database_sqlserver.go:175 Connect ---
~ could not connect to database
--- database.go:663 Connect ---
Read: EOF

and my ~/.sling/.env file

  FABRIC_WH2: # DOESNT WORK !!!!
    type: sqlserver # also tried azure-synapse-analytics
    host: REDACTED.datawarehouse.fabric.microsoft.com
    user: REDACTED
    password: "REDACTED"
    database: warehouse2
    schema: src_customer
    fedauth: ActiveDirectoryServicePrincipal

@shueybubbles shueybubbles reopened this Dec 18, 2024
@shueybubbles
Copy link
Collaborator

shueybubbles commented Dec 18, 2024

@johnoscott is it possible you can attach a logger to the driver with the log level set to 0x8fff?
The driver logs will have output like this:

Dialing with protocol tcp
Returning connection from protocol tcp
Creating prelogin packet with connection id '75639738-CA26-4942-806A-17FAEA55CC09' and activity id '680A2E5D-56F5-BB4E-9713-02813DE08F15'
Starting federated authentication using ADAL
aid:680A2E5D-56F5-BB4E-9713-02813DE08F15 cid:75639738-CA26-4942-806A-17FAEA55CC09 - got token tokenFedAuthInfo

At minimum you'd be able to verify the driver is correctly adding a connection id and activity id to the prelogin packet, and you could give those guids to Microsoft support if you need them to help identify why the connection is being closed.

One way you could get this same information is use the newest release from github.com/microsoft/go-sqlcmd and pass it on the command line:

sqlcmd -S xxx.datawarehouse.fabric.microsoft.com --authentication-method ActiveDirectoryDefault -Q "select @@version" --driver-logging-level 33279

@johnoscott
Copy link

johnoscott commented Dec 19, 2024

I am using macOS and I am expecting that authenticating with method ActiveDirectoryServicePrincipal will work (even though interactive authentication (which i am not using) is known not to work )

sqlcmd '-?'
Microsoft (R) SQL Server Command Line Tool
Version 18.4.0001.1 Linux

sqlcmd -S REDACTED.datawarehouse.fabric.microsoft.com --authentication-method ActiveDirectoryServicePrincipal -d fabric -U REDACTED -P "REDACTED" -Q "select @@version" --driver-logging-level 33279

Sqlcmd: '-authentication-method': Unknown Option. Enter '-?' for help.

So I tried Windows 11

sqlcmd '-?'
sqlcmd: Install/Create/Query SQL Server, Azure SQL, and Tools
Version: v1.8.0

sqlcmd -S REDACTED.datawarehouse.fabric.microsoft.com --authentication-method ActiveDirectoryServicePrincipal -d fabric -U REDACTED -P "REDACTED" -Q "select @@version" --driver-logging-level 33279
>> 
DRIVER:Dialing with protocol tcp
DRIVER:Returning connection from protocol tcp
DRIVER:Starting federated authentication using ADAL
DRIVER:got token tokenLoginAck
DRIVER:got token tokenEnvChange
DRIVER:got token tokenDone
DRIVER:got DONE or DONEPROC status=0
DRIVER:Dialing with protocol tcp
DRIVER:Returning connection from protocol tcp
DRIVER:Starting federated authentication using ADAL
DRIVER:got token tokenFedAuthInfo
DRIVER:BeginRead failed EOF
Read: EOF
Read: EOF

@johnoscott
Copy link

OK that macOS version was using sqlcmd from a package of mssql-tools, which explains the different version number. When i install sqlcmd directly i get ...

❯ sqlcmd '-?'
sqlcmd: Install/Create/Query SQL Server, Azure SQL, and Tools

Version: 1.8.0

sqlcmd -S REDACTED.datawarehouse.fabric.microsoft.com --authentication-method ActiveDirectoryServicePrincipal -d fabric -U REDACTED -P "REDACTED" -Q "select @@version" --driver-logging-level 33279

DRIVER:Dialing with protocol tcp
DRIVER:Returning connection from protocol tcp
DRIVER:Starting federated authentication using ADAL
DRIVER:got token tokenLoginAck
DRIVER:got token tokenEnvChange
DRIVER:got token tokenDone
DRIVER:got DONE or DONEPROC status=0
DRIVER:Dialing with protocol tcp
DRIVER:Returning connection from protocol tcp
DRIVER:Starting federated authentication using ADAL
DRIVER:got token tokenFedAuthInfo
DRIVER:BeginRead failed EOF
Read: EOF
Read: EOF

@shueybubbles
Copy link
Collaborator

@johnoscott sorry I should have been more explicit - go-sqlcmd v1.8.2 still hasn't been marked as "latest" but it's the version that has the activity id and connection id fix.

@johnoscott
Copy link

OK it appears to be working with upcoming v1.8.2

sqlcmd '-?'
sqlcmd: Install/Create/Query SQL Server, Azure SQL, and Tools

Version: local-build 1.8.2

sqlcmd -S REDACTED.datawarehouse.fabric.microsoft.com --authentication-method ActiveDirectoryServicePrincipal -d fabric -U REDACTED -P "REDACTED" -Q "select @@version" --driver-logging-level 33279

DRIVER:Dialing with protocol tcp
DRIVER:Returning connection from protocol tcp
DRIVER:Creating prelogin packet with connection id 'FD8ED07E-5F0C-3B40-888C-BDBA8232105A' and activity id '5206C7D1-1467-DD49-BE25-065036BA6BD2'
DRIVER:Starting federated authentication using ADAL
DRIVER:aid:5206C7D1-1467-DD49-BE25-065036BA6BD2 cid:FD8ED07E-5F0C-3B40-888C-BDBA8232105A - got token tokenLoginAck
DRIVER:aid:5206C7D1-1467-DD49-BE25-065036BA6BD2 cid:FD8ED07E-5F0C-3B40-888C-BDBA8232105A - got token tokenEnvChange
DRIVER:aid:5206C7D1-1467-DD49-BE25-065036BA6BD2 cid:FD8ED07E-5F0C-3B40-888C-BDBA8232105A - got token tokenDone
DRIVER:aid:5206C7D1-1467-DD49-BE25-065036BA6BD2 cid:FD8ED07E-5F0C-3B40-888C-BDBA8232105A - got DONE or DONEPROC status=0
DRIVER:Dialing with protocol tcp
DRIVER:Returning connection from protocol tcp
DRIVER:Creating prelogin packet with connection id '0067E946-CD28-8D42-BB2B-377560D94EE6' and activity id '5206C7D1-1467-DD49-BE25-065036BA6BD2'
DRIVER:Starting federated authentication using ADAL
DRIVER:aid:5206C7D1-1467-DD49-BE25-065036BA6BD2 cid:0067E946-CD28-8D42-BB2B-377560D94EE6 - got token tokenFedAuthInfo
DRIVER:aid:5206C7D1-1467-DD49-BE25-065036BA6BD2 cid:0067E946-CD28-8D42-BB2B-377560D94EE6 - got token tokenEnvChange
DRIVER:aid:5206C7D1-1467-DD49-BE25-065036BA6BD2 cid:0067E946-CD28-8D42-BB2B-377560D94EE6 - got token tokenInfo
DRIVER:aid:5206C7D1-1467-DD49-BE25-065036BA6BD2 cid:0067E946-CD28-8D42-BB2B-377560D94EE6 - got INFO 5701 Changed database context to 'warehouse2'.
DRIVER:aid:5206C7D1-1467-DD49-BE25-065036BA6BD2 cid:0067E946-CD28-8D42-BB2B-377560D94EE6 - Changed database context to 'warehouse2'.
DRIVER:aid:5206C7D1-1467-DD49-BE25-065036BA6BD2 cid:0067E946-CD28-8D42-BB2B-377560D94EE6 - got token tokenEnvChange
DRIVER:aid:5206C7D1-1467-DD49-BE25-065036BA6BD2 cid:0067E946-CD28-8D42-BB2B-377560D94EE6 - got token tokenEnvChange
DRIVER:aid:5206C7D1-1467-DD49-BE25-065036BA6BD2 cid:0067E946-CD28-8D42-BB2B-377560D94EE6 - got token tokenInfo
DRIVER:aid:5206C7D1-1467-DD49-BE25-065036BA6BD2 cid:0067E946-CD28-8D42-BB2B-377560D94EE6 - got INFO 5703 Changed language setting to us_english.
DRIVER:aid:5206C7D1-1467-DD49-BE25-065036BA6BD2 cid:0067E946-CD28-8D42-BB2B-377560D94EE6 - Changed language setting to us_english.
DRIVER:aid:5206C7D1-1467-DD49-BE25-065036BA6BD2 cid:0067E946-CD28-8D42-BB2B-377560D94EE6 - got token tokenLoginAck
DRIVER:aid:5206C7D1-1467-DD49-BE25-065036BA6BD2 cid:0067E946-CD28-8D42-BB2B-377560D94EE6 - got token tokenEnvChange
DRIVER:aid:5206C7D1-1467-DD49-BE25-065036BA6BD2 cid:0067E946-CD28-8D42-BB2B-377560D94EE6 - got token tokenFeatureExtAck
DRIVER:aid:5206C7D1-1467-DD49-BE25-065036BA6BD2 cid:0067E946-CD28-8D42-BB2B-377560D94EE6 - got token tokenDone
DRIVER:aid:5206C7D1-1467-DD49-BE25-065036BA6BD2 cid:0067E946-CD28-8D42-BB2B-377560D94EE6 - got DONE or DONEPROC status=0
DRIVER:aid:5206C7D1-1467-DD49-BE25-065036BA6BD2 cid:0067E946-CD28-8D42-BB2B-377560D94EE6 - select @@version
DRIVER:aid:5206C7D1-1467-DD49-BE25-065036BA6BD2 cid:0067E946-CD28-8D42-BB2B-377560D94EE6 - got token tokenColMetadata
DRIVER:aid:5206C7D1-1467-DD49-BE25-065036BA6BD2 cid:0067E946-CD28-8D42-BB2B-377560D94EE6 - got token tokenRow
DRIVER:aid:5206C7D1-1467-DD49-BE25-065036BA6BD2 cid:0067E946-CD28-8D42-BB2B-377560D94EE6 - got token tokenDone
DRIVER:aid:5206C7D1-1467-DD49-BE25-065036BA6BD2 cid:0067E946-CD28-8D42-BB2B-377560D94EE6 - got DONE or DONEPROC status=16
DRIVER:aid:5206C7D1-1467-DD49-BE25-065036BA6BD2 cid:0067E946-CD28-8D42-BB2B-377560D94EE6 - (Rows affected: 1)
DRIVER:aid:5206C7D1-1467-DD49-BE25-065036BA6BD2 cid:0067E946-CD28-8D42-BB2B-377560D94EE6 - Columns() token type:[]mssql.columnStruct
                                                                                                                                                                                                                                                                                                            
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
DRIVER:aid:5206C7D1-1467-DD49-BE25-065036BA6BD2 cid:0067E946-CD28-8D42-BB2B-377560D94EE6 - Next() token type:[]interface {}
Microsoft Azure SQL Data Warehouse (RTM) - 12.0.2000.8 
	Nov 11 2024 10:20:51 
	Copyright (C) 2024 Microsoft Corporation
                                                                                                                                                                                   
DRIVER:aid:5206C7D1-1467-DD49-BE25-065036BA6BD2 cid:0067E946-CD28-8D42-BB2B-377560D94EE6 - Next() token type:mssql.doneStruct

(1 row affected)

@johnoscott
Copy link

@shueybubbles when can we expect 1.8.2 to be marked as latest ?

@shueybubbles
Copy link
Collaborator

it was marked latest already

@flarco
Copy link

flarco commented Jan 6, 2025

@shueybubbles thanks, I see the most recent release shows 1.8.0: https://github.com/microsoft/go-mssqldb/releases
Will there be a release for 1.8.2 so other projects can import as a module?

Image

@shueybubbles
Copy link
Collaborator

go-sqlcmd v1.8.2 uses go-mssqldb 1.8.0. Both are marked latest.

@flarco
Copy link

flarco commented Jan 13, 2025

@shueybubbles This is the URL that sling is using to connect:

sqlserver://REDACTED_USER:[email protected]:1433?app+name=sling&database=johnmosa&fedauth=ActiveDirectoryServicePrincipal

Do you mind looking at it and sharing if anything is wrong with it? Sling calls a sql.Open with it and it's returning the Read: EOF error, using github.com/microsoft/go-mssqldb v1.8.0.

@shueybubbles
Copy link
Collaborator

@flarco I think the string is ok. Can you attach a logger to the driver with level 33279 ?

It should emit a trace like this: Creating prelogin packet with connection id

It's possible that something with your environment somehow bypasses that connection id generation.

@flarco
Copy link

flarco commented Jan 15, 2025

@shueybubbles is there an environment variable that I can use to set the log level?
I tried with the conn string, like this: sqlserver://user:passwrd@pc:1433?app+name=sling&database=master&log=33279 but it's not printing anything logwise.

@shueybubbles
Copy link
Collaborator

I think you need to use mssql.SetContextLogger or mssql.SetLogger with your own logger implementation.

@flarco
Copy link

flarco commented Jan 16, 2025

@shueybubbles thank you, using mssql.SetLogger works.

@johnoscott can you download the latest dev build and post the output with log=33279?

Dialing with protocol tcp
Returning connection from protocol tcp
Creating prelogin packet with connection id '0E12CFD2-242A-B14B-AF37-40AD13228616' and activity id '61A2A8F1-D1C7-DE45-9A00-90F15FDE7B78'
aid:61A2A8F1-D1C7-DE45-9A00-90F15FDE7B78 cid:0E12CFD2-242A-B14B-AF37-40AD13228616 - got token tokenEnvChange
aid:61A2A8F1-D1C7-DE45-9A00-90F15FDE7B78 cid:0E12CFD2-242A-B14B-AF37-40AD13228616 - got token tokenInfo
aid:61A2A8F1-D1C7-DE45-9A00-90F15FDE7B78 cid:0E12CFD2-242A-B14B-AF37-40AD13228616 - got INFO 5701 Changed database context to 'master'.
aid:61A2A8F1-D1C7-DE45-9A00-90F15FDE7B78 cid:0E12CFD2-242A-B14B-AF37-40AD13228616 - Changed database context to 'master'.

@johnoscott
Copy link

here you go @flarco.

The only way i could get the log=33279 in the connection string was to add it to the connection params in ~/.sling/env.yaml

❯ ./sling --version                     
Version: 1.3.6.dev (2025-01-17)

❯ DEBUG=TRACE ./sling conns test FABRIC_JOHNMOSA 
2025-01-17 21:19:05 TRC no type detected
2025-01-17 21:19:05 TRC no type detected
2025-01-17 21:19:05 TRC no type detected
2025-01-17 21:19:05 TRC connURL -> sqlserver://REDACTED_USER:[email protected]:1433?app+name=sling&database=johnmosa&fedauth=ActiveDirectoryServicePrincipal&log=33279
Dialing with protocol tcp
Returning connection from protocol tcp
Creating prelogin packet with connection id 'EAD6B8F1-3AE7-A841-9EB0-B2D14453C511' and activity id '961463BA-B959-8249-8348-B6156A3B1809'
aid:961463BA-B959-8249-8348-B6156A3B1809 cid:EAD6B8F1-3AE7-A841-9EB0-B2D14453C511 - got token tokenLoginAck
aid:961463BA-B959-8249-8348-B6156A3B1809 cid:EAD6B8F1-3AE7-A841-9EB0-B2D14453C511 - got token tokenEnvChange
aid:961463BA-B959-8249-8348-B6156A3B1809 cid:EAD6B8F1-3AE7-A841-9EB0-B2D14453C511 - got token tokenDone
aid:961463BA-B959-8249-8348-B6156A3B1809 cid:EAD6B8F1-3AE7-A841-9EB0-B2D14453C511 - got DONE or DONEPROC status=0
Dialing with protocol tcp
Returning connection from protocol tcp
Creating prelogin packet with connection id '9CFA313B-4A2A-B24B-99D7-0419DEE850FB' and activity id '961463BA-B959-8249-8348-B6156A3B1809'
ERROR: aid:961463BA-B959-8249-8348-B6156A3B1809 cid:9CFA313B-4A2A-B24B-99D7-0419DEE850FB - BeginRead failed EOF
2025-01-17 21:19:07 DBG closed "sqlserver" connection (conn-sqlserver-lx1)
2025-01-17 21:19:08 TRC post event response: 202 Accepted
ok
fatal:
--- proc.go:271 main ---
--- sling_cli.go:479 main ---
--- sling_cli.go:515 cliInit ---
--- cli.go:286 CliProcess ---
--- sling_conns.go:184 processConns ---
--- connection_local.go:64 Test ---
~ could not test FABRIC_JOHNMOSA
--- connection_discover.go:24 Test ---
~ could not connect to FABRIC_JOHNMOSA
--- database_sqlserver.go:194 Connect ---
~ could not connect to database
--- database.go:669 Connect ---
Read: EOF

@flarco
Copy link

flarco commented Jan 17, 2025

@shueybubbles does that log help?

@shueybubbles
Copy link
Collaborator

I think you can use those activity and connection IDs to open a support ticket with the Fabric DW team to find out why the service closed the second connection. I don't know much about their service other than what they indicated in #228

@johnoscott
Copy link

@shueybubbles i am not sure a support ticket will help. I used the same credentials to make a successful connection with both a python app and sqlcmd. What else do you think could cause the connection to fail ?

@shueybubbles
Copy link
Collaborator

it's not a credential problem; it's likely some subtle TDS protocol issue where Fabric DW has decided the driver has violated the protocol. The source of this issue was go-mssqldb was not adding connection and activity guids to the prelogin packet, leading the Fabric DW rejecting the connection. Maybe there's some other bit missing from a TDS packet which they are rejecting. We don't know what the real problem is without that team's input. The connection and activity guids in prelogin are kept in their telemetry, so their support team should be able to find the connection attempt and give a reason for the rejection.

@flarco
Copy link

flarco commented Jan 19, 2025

@johnoscott I added logic to emulate the authentication conn string the same way sqlcmd auths here: https://github.com/microsoft/go-sqlcmd/blob/main/pkg/sqlcmd/sqlcmd.go#L278

Can you give the latest dev build a try to see if it makes a difference?

@johnoscott
Copy link

@flarco I tried again with latest dev version (had same 1.3.6 version as last one but with later build date).

Connection is still failing.

I added a sqlcmd debug output using same credentials for comparison. Of note is it has DRIVER:Starting federated authentication using ADAL which i dont see in the sling debug output.

Also, what is the applicationclientid=REDACTED in the sling connection string for ? My understanding is that this is not necessary for ActiveDirectoryServicePrincipal auth because its provided as the username.

./sling --version
Version: 1.3.6.dev (2025-01-19)
DEBUG=TRACE ./sling conns test FABRIC_JOHNMOSA
2025-01-20 14:42:22 TRC no type detected for CONTROL_NATS_URL
2025-01-20 14:42:22 TRC connURL -> sqlserver://REDACTED:[email protected]:1433?app+name=sling&applicationclientid=REDACTED&clientcertpath=&database=johnmosa&fedauth=ActiveDirectoryServicePrincipal&log=33279
Dialing with protocol tcp
Returning connection from protocol tcp
Creating prelogin packet with connection id '87D0A312-F882-E146-9A25-792AB7F01462' and activity id '266279DE-526A-284E-A6F0-A661D6F6DC82'
aid:266279DE-526A-284E-A6F0-A661D6F6DC82 cid:87D0A312-F882-E146-9A25-792AB7F01462 - got token tokenLoginAck
aid:266279DE-526A-284E-A6F0-A661D6F6DC82 cid:87D0A312-F882-E146-9A25-792AB7F01462 - got token tokenEnvChange
aid:266279DE-526A-284E-A6F0-A661D6F6DC82 cid:87D0A312-F882-E146-9A25-792AB7F01462 - got token tokenDone
aid:266279DE-526A-284E-A6F0-A661D6F6DC82 cid:87D0A312-F882-E146-9A25-792AB7F01462 - got DONE or DONEPROC status=0
Dialing with protocol tcp
Returning connection from protocol tcp
Creating prelogin packet with connection id 'E61B4C8A-89C7-8942-B8B1-761DAB7ED2FA' and activity id '266279DE-526A-284E-A6F0-A661D6F6DC82'
ERROR: aid:266279DE-526A-284E-A6F0-A661D6F6DC82 cid:E61B4C8A-89C7-8942-B8B1-761DAB7ED2FA - BeginRead failed EOF
2025-01-20 14:42:25 DBG closed "sqlserver" connection (conn-sqlserver-pVP)
fatal:
--- proc.go:271 main ---
--- sling_cli.go:476 main ---
--- sling_cli.go:512 cliInit ---
--- cli.go:286 CliProcess ---
--- sling_conns.go:184 processConns ---
--- connection_local.go:64 Test ---
~ could not test FABRIC_JOHNMOSA
--- connection_discover.go:24 Test ---
~ could not connect to FABRIC_JOHNMOSA
--- database_sqlserver.go:213 Connect ---
~ could not connect to database
--- database.go:669 Connect ---
Read: EOF

Follow Sling's Evolution 👉 https://x.com/SlingDataIO
make: *** [slingdev-debug] Error 1



For comparison, here is a sqlcmd debug output using the same credentials.

sqlcmd \
                -S REDACTED.datawarehouse.fabric.microsoft.com \
                --authentication-method ActiveDirectoryServicePrincipal \
                -d johnmosa \
                -U "REDACTED" \
                -P "REDACTED" \
                -Q "select name from sys.tables" \
                --driver-logging-level 33279
DRIVER:Dialing with protocol tcp
DRIVER:Returning connection from protocol tcp
DRIVER:Creating prelogin packet with connection id '264C4D62-9CEC-834C-BDF0-A764ECEA2D50' and activity id '0363862E-7823-374F-BBB1-22EC26B29291'
DRIVER:Starting federated authentication using ADAL
DRIVER:aid:0363862E-7823-374F-BBB1-22EC26B29291 cid:264C4D62-9CEC-834C-BDF0-A764ECEA2D50 - got token tokenLoginAck
DRIVER:aid:0363862E-7823-374F-BBB1-22EC26B29291 cid:264C4D62-9CEC-834C-BDF0-A764ECEA2D50 - got token tokenEnvChange
DRIVER:aid:0363862E-7823-374F-BBB1-22EC26B29291 cid:264C4D62-9CEC-834C-BDF0-A764ECEA2D50 - got token tokenDone
DRIVER:aid:0363862E-7823-374F-BBB1-22EC26B29291 cid:264C4D62-9CEC-834C-BDF0-A764ECEA2D50 - got DONE or DONEPROC status=0
DRIVER:Dialing with protocol tcp
DRIVER:Returning connection from protocol tcp
DRIVER:Creating prelogin packet with connection id 'BDFAA1D1-D06C-F44D-9BB2-6FD7EC731765' and activity id '0363862E-7823-374F-BBB1-22EC26B29291'
DRIVER:Starting federated authentication using ADAL
DRIVER:aid:0363862E-7823-374F-BBB1-22EC26B29291 cid:BDFAA1D1-D06C-F44D-9BB2-6FD7EC731765 - got token tokenFedAuthInfo
DRIVER:aid:0363862E-7823-374F-BBB1-22EC26B29291 cid:BDFAA1D1-D06C-F44D-9BB2-6FD7EC731765 - got token tokenEnvChange
DRIVER:aid:0363862E-7823-374F-BBB1-22EC26B29291 cid:BDFAA1D1-D06C-F44D-9BB2-6FD7EC731765 - got token tokenInfo
DRIVER:aid:0363862E-7823-374F-BBB1-22EC26B29291 cid:BDFAA1D1-D06C-F44D-9BB2-6FD7EC731765 - got INFO 5701 Changed database context to 'johnmosa'.
DRIVER:aid:0363862E-7823-374F-BBB1-22EC26B29291 cid:BDFAA1D1-D06C-F44D-9BB2-6FD7EC731765 - Changed database context to 'johnmosa'.
DRIVER:aid:0363862E-7823-374F-BBB1-22EC26B29291 cid:BDFAA1D1-D06C-F44D-9BB2-6FD7EC731765 - got token tokenEnvChange
DRIVER:aid:0363862E-7823-374F-BBB1-22EC26B29291 cid:BDFAA1D1-D06C-F44D-9BB2-6FD7EC731765 - got token tokenEnvChange
DRIVER:aid:0363862E-7823-374F-BBB1-22EC26B29291 cid:BDFAA1D1-D06C-F44D-9BB2-6FD7EC731765 - got token tokenInfo
DRIVER:aid:0363862E-7823-374F-BBB1-22EC26B29291 cid:BDFAA1D1-D06C-F44D-9BB2-6FD7EC731765 - got INFO 5703 Changed language setting to us_english.
DRIVER:aid:0363862E-7823-374F-BBB1-22EC26B29291 cid:BDFAA1D1-D06C-F44D-9BB2-6FD7EC731765 - Changed language setting to us_english.
DRIVER:aid:0363862E-7823-374F-BBB1-22EC26B29291 cid:BDFAA1D1-D06C-F44D-9BB2-6FD7EC731765 - got token tokenLoginAck
DRIVER:aid:0363862E-7823-374F-BBB1-22EC26B29291 cid:BDFAA1D1-D06C-F44D-9BB2-6FD7EC731765 - got token tokenEnvChange
DRIVER:aid:0363862E-7823-374F-BBB1-22EC26B29291 cid:BDFAA1D1-D06C-F44D-9BB2-6FD7EC731765 - got token tokenFeatureExtAck
DRIVER:aid:0363862E-7823-374F-BBB1-22EC26B29291 cid:BDFAA1D1-D06C-F44D-9BB2-6FD7EC731765 - got token tokenDone
DRIVER:aid:0363862E-7823-374F-BBB1-22EC26B29291 cid:BDFAA1D1-D06C-F44D-9BB2-6FD7EC731765 - got DONE or DONEPROC status=0
DRIVER:aid:0363862E-7823-374F-BBB1-22EC26B29291 cid:BDFAA1D1-D06C-F44D-9BB2-6FD7EC731765 - select name from sys.tables
DRIVER:aid:0363862E-7823-374F-BBB1-22EC26B29291 cid:BDFAA1D1-D06C-F44D-9BB2-6FD7EC731765 - got token tokenEnvChange
DRIVER:aid:0363862E-7823-374F-BBB1-22EC26B29291 cid:BDFAA1D1-D06C-F44D-9BB2-6FD7EC731765 - got token tokenColMetadata
DRIVER:aid:0363862E-7823-374F-BBB1-22EC26B29291 cid:BDFAA1D1-D06C-F44D-9BB2-6FD7EC731765 - got token tokenRow
DRIVER:aid:0363862E-7823-374F-BBB1-22EC26B29291 cid:BDFAA1D1-D06C-F44D-9BB2-6FD7EC731765 - got token tokenDone
DRIVER:aid:0363862E-7823-374F-BBB1-22EC26B29291 cid:BDFAA1D1-D06C-F44D-9BB2-6FD7EC731765 - got DONE or DONEPROC status=16
DRIVER:aid:0363862E-7823-374F-BBB1-22EC26B29291 cid:BDFAA1D1-D06C-F44D-9BB2-6FD7EC731765 - (Rows affected: 1)
DRIVER:aid:0363862E-7823-374F-BBB1-22EC26B29291 cid:BDFAA1D1-D06C-F44D-9BB2-6FD7EC731765 - Columns() token type:[]mssql.columnStruct
name                                                                                                                            
--------------------------------------------------------------------------------------------------------------------------------
DRIVER:aid:0363862E-7823-374F-BBB1-22EC26B29291 cid:BDFAA1D1-D06C-F44D-9BB2-6FD7EC731765 - Next() token type:[]interface {}
table1                                                                                                                          
DRIVER:aid:0363862E-7823-374F-BBB1-22EC26B29291 cid:BDFAA1D1-D06C-F44D-9BB2-6FD7EC731765 - Next() token type:mssql.doneStruct

(1 row affected)

@shueybubbles
Copy link
Collaborator

@johnoscott Oh I think the issue is probably the driver name.

sqlserver is the non-Entra-aware driver name. The Entra-aware driver is declared in the azuread package as azuresql

@johnoscott
Copy link

@flarco does this help ?

@flarco
Copy link

flarco commented Jan 22, 2025

@johnoscott I was just looking at this. Pushed a change to use azuresql driver.
Could you give it another try with the latest?

@johnoscott
Copy link

Alright ! Its working now 👍

Here is the debug output

./sling --version
Version: 1.3.6.dev (2025-01-22)

DEBUG=TRACE ./sling conns test FABRIC_JOHNMOSA
2025-01-23 09:21:50 TRC no type detected for CONTROL_NATS_URL
2025-01-23 09:21:50 TRC connURL -> sqlserver://REDACTED:[email protected]:1433?app+name=sling&database=johnmosa&fedauth=ActiveDirectoryServicePrincipal&log=33279
Dialing with protocol tcp
Returning connection from protocol tcp
Creating prelogin packet with connection id 'E44F9002-A231-124B-948C-EB4D3A7D0B7B' and activity id '1E1CB9E8-70C2-0A4B-A723-A14FF16C48A2'
Starting federated authentication using ADAL
aid:1E1CB9E8-70C2-0A4B-A723-A14FF16C48A2 cid:E44F9002-A231-124B-948C-EB4D3A7D0B7B - got token tokenLoginAck
aid:1E1CB9E8-70C2-0A4B-A723-A14FF16C48A2 cid:E44F9002-A231-124B-948C-EB4D3A7D0B7B - got token tokenEnvChange
aid:1E1CB9E8-70C2-0A4B-A723-A14FF16C48A2 cid:E44F9002-A231-124B-948C-EB4D3A7D0B7B - got token tokenDone
aid:1E1CB9E8-70C2-0A4B-A723-A14FF16C48A2 cid:E44F9002-A231-124B-948C-EB4D3A7D0B7B - got DONE or DONEPROC status=0
Dialing with protocol tcp
Returning connection from protocol tcp
Creating prelogin packet with connection id 'B1D5E44B-DB8D-7345-8003-431BB2F41B97' and activity id '1E1CB9E8-70C2-0A4B-A723-A14FF16C48A2'
Starting federated authentication using ADAL
aid:1E1CB9E8-70C2-0A4B-A723-A14FF16C48A2 cid:B1D5E44B-DB8D-7345-8003-431BB2F41B97 - got token tokenFedAuthInfo
aid:1E1CB9E8-70C2-0A4B-A723-A14FF16C48A2 cid:B1D5E44B-DB8D-7345-8003-431BB2F41B97 - got token tokenEnvChange
aid:1E1CB9E8-70C2-0A4B-A723-A14FF16C48A2 cid:B1D5E44B-DB8D-7345-8003-431BB2F41B97 - got token tokenInfo
aid:1E1CB9E8-70C2-0A4B-A723-A14FF16C48A2 cid:B1D5E44B-DB8D-7345-8003-431BB2F41B97 - got INFO 5701 Changed database context to 'johnmosa'.
aid:1E1CB9E8-70C2-0A4B-A723-A14FF16C48A2 cid:B1D5E44B-DB8D-7345-8003-431BB2F41B97 - Changed database context to 'johnmosa'.
aid:1E1CB9E8-70C2-0A4B-A723-A14FF16C48A2 cid:B1D5E44B-DB8D-7345-8003-431BB2F41B97 - got token tokenEnvChange
aid:1E1CB9E8-70C2-0A4B-A723-A14FF16C48A2 cid:B1D5E44B-DB8D-7345-8003-431BB2F41B97 - got token tokenEnvChange
aid:1E1CB9E8-70C2-0A4B-A723-A14FF16C48A2 cid:B1D5E44B-DB8D-7345-8003-431BB2F41B97 - got token tokenInfo
aid:1E1CB9E8-70C2-0A4B-A723-A14FF16C48A2 cid:B1D5E44B-DB8D-7345-8003-431BB2F41B97 - got INFO 5703 Changed language setting to us_english.
aid:1E1CB9E8-70C2-0A4B-A723-A14FF16C48A2 cid:B1D5E44B-DB8D-7345-8003-431BB2F41B97 - Changed language setting to us_english.
aid:1E1CB9E8-70C2-0A4B-A723-A14FF16C48A2 cid:B1D5E44B-DB8D-7345-8003-431BB2F41B97 - got token tokenLoginAck
aid:1E1CB9E8-70C2-0A4B-A723-A14FF16C48A2 cid:B1D5E44B-DB8D-7345-8003-431BB2F41B97 - got token tokenEnvChange
aid:1E1CB9E8-70C2-0A4B-A723-A14FF16C48A2 cid:B1D5E44B-DB8D-7345-8003-431BB2F41B97 - got token tokenFeatureExtAck
aid:1E1CB9E8-70C2-0A4B-A723-A14FF16C48A2 cid:B1D5E44B-DB8D-7345-8003-431BB2F41B97 - got token tokenDone
aid:1E1CB9E8-70C2-0A4B-A723-A14FF16C48A2 cid:B1D5E44B-DB8D-7345-8003-431BB2F41B97 - got DONE or DONEPROC status=0
aid:1E1CB9E8-70C2-0A4B-A723-A14FF16C48A2 cid:B1D5E44B-DB8D-7345-8003-431BB2F41B97 - select 1;
aid:1E1CB9E8-70C2-0A4B-A723-A14FF16C48A2 cid:B1D5E44B-DB8D-7345-8003-431BB2F41B97 - got token tokenEnvChange
aid:1E1CB9E8-70C2-0A4B-A723-A14FF16C48A2 cid:B1D5E44B-DB8D-7345-8003-431BB2F41B97 - got token tokenColMetadata
aid:1E1CB9E8-70C2-0A4B-A723-A14FF16C48A2 cid:B1D5E44B-DB8D-7345-8003-431BB2F41B97 - got token tokenRow
aid:1E1CB9E8-70C2-0A4B-A723-A14FF16C48A2 cid:B1D5E44B-DB8D-7345-8003-431BB2F41B97 - got token tokenDone
aid:1E1CB9E8-70C2-0A4B-A723-A14FF16C48A2 cid:B1D5E44B-DB8D-7345-8003-431BB2F41B97 - got DONE or DONEPROC status=16
aid:1E1CB9E8-70C2-0A4B-A723-A14FF16C48A2 cid:B1D5E44B-DB8D-7345-8003-431BB2F41B97 - (Rows affected: 1)
2025-01-23 09:21:55 DBG opened "sqlserver" connection (conn-sqlserver-6gH)
2025-01-23 09:21:55 TRC select @@version v /* nD */ conn=conn-sqlserver-6gH
aid:1E1CB9E8-70C2-0A4B-A723-A14FF16C48A2 cid:B1D5E44B-DB8D-7345-8003-431BB2F41B97 - select @@version v /* nD */
aid:1E1CB9E8-70C2-0A4B-A723-A14FF16C48A2 cid:B1D5E44B-DB8D-7345-8003-431BB2F41B97 - got token tokenEnvChange
aid:1E1CB9E8-70C2-0A4B-A723-A14FF16C48A2 cid:B1D5E44B-DB8D-7345-8003-431BB2F41B97 - got token tokenColMetadata
aid:1E1CB9E8-70C2-0A4B-A723-A14FF16C48A2 cid:B1D5E44B-DB8D-7345-8003-431BB2F41B97 - got token tokenRow
aid:1E1CB9E8-70C2-0A4B-A723-A14FF16C48A2 cid:B1D5E44B-DB8D-7345-8003-431BB2F41B97 - got token tokenDone
aid:1E1CB9E8-70C2-0A4B-A723-A14FF16C48A2 cid:B1D5E44B-DB8D-7345-8003-431BB2F41B97 - got DONE or DONEPROC status=16
aid:1E1CB9E8-70C2-0A4B-A723-A14FF16C48A2 cid:B1D5E44B-DB8D-7345-8003-431BB2F41B97 - (Rows affected: 1)
2025-01-23 09:21:55 TRC query responded in 0.266341 secs
2025-01-23 09:21:55 TRC query returned 1 rows
2025-01-23 09:21:55 DBG closed "azuredwh" connection (conn-sqlserver-6gH)
2025-01-23 09:21:55 INF success!

@flarco
Copy link

flarco commented Jan 22, 2025

@johnoscott Great!
Thank you @shueybubbles.

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

No branches or pull requests

4 participants