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

Ping automatically changes the port to 1434. I used the connection string with Port 1433. I can connect but when I ping it is getting timedout. #793

Open
nanduIyer opened this issue Dec 23, 2023 · 1 comment

Comments

@nanduIyer
Copy link

nanduIyer commented Dec 23, 2023

Describe the bug
@LuisBosquez
When I tried to connect to SQL Server, it got connected. Unable to ping or query the tables.

connString := fmt.Sprintf("server=%s;user id=%s;password=%s;port=%d;",
MES_DB_SERVER, MES_USERNAME, MES_PASSWORD, MES_PORT)
fmt.Println(connString)
//conS := fmt.Sprintf("sqlserver://%s:%s@%s:$d/")
// create connection pool
dbcon, err = sql.Open(MES_DB_TYPE, connString)
if err != nil {
log.Fatal("Error creating connection pool: " + err.Error())
}
log.Printf("Connected!\n")

When I ping I am getting error
ctx := context.Background()

err := dbcon.PingContext(ctx)
if err != nil {
	log.Fatal("Error pinging DB : ", err.Error())
}

If you see the error message it says udp with 1434. I checked TCP is enabled and restarted the db several times. Any help will be appreciated.
Error message:

PS C:\Users\g_nan\Documents\Goworkspace\DatabaseSQLGo> go run main.go
server=NANDU\SQLEXPRESS;user id=SA;password=Sapwd1298;port=1433;
2023/12/22 23:27:48 Connected!
2023/12/22 23:28:03 Error pinging DB : unable to get instances from Sql Server Browser on host NANDU: read udp [fe80::c635:3f67:afd0:eaef%Ethernet 3]:63108->[fe80::c635:3f67:afd0:eaef%Ethernet 3]:1434: i/o timeout
exit status 1

If you are seeing an exception, include the full exceptions details (message and stack trace).

Exception message:
PS C:\Users\g_nan\Documents\Goworkspace\DatabaseSQLGo> go run main.go
server=NANDU\\SQLEXPRESS;user id=SA;password=Sapwd1298;port=1433;
2023/12/22 23:27:48 Connected!
2023/12/22 23:28:03 Error pinging DB : unable to get instances from Sql Server Browser on host NANDU: read udp [fe80::c635:3f67:afd0:eaef%Ethernet 3]:63108->[fe80::c635:3f67:afd0:eaef%Ethernet 3]:1434: i/o timeout
exit status 1

Stack trace:

To Reproduce
Include a complete code listing that we can run to reproduce the issue.

Partial code listings, or multiple fragments of code, will slow down our response or cause us to push the issue back to you to provide code to reproduce the issue.

Expected behavior
A clear and concise description of what you expected to happen.

Further technical details

SQL Server version: express edition
Operating system: windows 11
Table schema

Additional context
Add any other context about the problem here.

@SantiiRepair
Copy link

same issue for me, I've set port to 1433

read udp 127.0.0.1:49834->127.0.0.1:1434: i/o timeout

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

2 participants