denisenkom / go-mssqldb

Microsoft SQL server driver written in go language
BSD 3-Clause "New" or "Revised" License
1.82k stars 500 forks source link

\\ sign in hostname breaks DB Connection #633 #634

Open mehmetkara5007 opened 3 years ago

mehmetkara5007 commented 3 years ago

I am using different signs for variables of password, username and host name. I can wrap chars @,#,$,%,& by using Url.QueryEscape()

But I can not deal with "\" and "|" inside host name. (myapp.abc\snd or myapp.abc|snd) I am taking error: invalid URL escape \"%7C\"" even if I use url.PathEscape.

How can I solve this problem?

Thanks

mehmetkara5007 commented 3 years ago

any help?

denysvitali commented 3 years ago

I don't think that an hostname can have a backslash. You are probably looking at hostname/instance

mehmetkara5007 commented 3 years ago

have a backslash. You are pro

I have 2 back slash for hostname in configuration page. It was working good with GORM 1

tc-hib commented 3 years ago

Hello,

Instances use one backslash: hostname\instance

If you read the Readme, you'll see you should replace the backslash by a slash in the URL. Or you can use another kind of connection string : ADO or ODBC.