go-mssqldb: Issue: Connection to Data Warehouse SQL Endpoint in Microsoft Fabric Fails with "Read: EOF" Error
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!
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 34
@johnoscott Oh I think the issue is probably the driver name.
sqlserveris the non-Entra-aware driver name. The Entra-aware driver is declared in theazureadpackage asazuresqlgo-sqlcmd v1.8.2 uses go-mssqldb 1.8.0. Both are marked
latest.