distal-attribute
distal-attribute
distal-attribute
distal-attribute

error in connecting when password contains semicolon

jenda86 posted 10 months ago in General
Hello.

I am having problems when I try to connect to MSSQL server when password contains semicolon (i.e. abds;abc ) - HeidiSQL doesnt even try to connect and outputs error message: SQL Error(0) - Invalid argument of connection string (I translated this message from my native language, I hope it is right, I couldn't get it in English).

Since the server isn't under my management, but client's, it is not possible to change the pass, thus I cannot connect at all.

You might look into it.
Thanks.
Max posted 10 months ago
Hey jenda86

i got the same problem when i used heidi sql and the ssl tunnel. The problem is you use an " in your passwort and when plink.exe tried to connect to the server it looks like

plink.exe -P 22 -L 3307:127.0.0.1:3306 -pw "yourPW" root@host.com

so when you have a double quotes in your password plink.exe dont send all the password it will send only to the second double quote.

Example: your"pw

plink.exe will send onli your because the syntax is

plink.exe -P 22 -L 3307:127.0.0.1:3306 -pw "your"PW" root@host.com

try to change the password on the mysql host or open plink.exe manually... like this http://www.heidisql.com/forum.php?t=6561
jenda86 posted 10 months ago
Hello.

Thanks for reply.
However that does not describe my problem.
I am not using SSH tunnel and not MYSQL at all. And I cannot change the password of MSSQL password, since it is server of our client who uses it elsewhere.

And when I try to connect with password where is not semicolon (;) the application at least try to connect. With semicolon it doesnt even try to connect and gives me that error msg.
ansgar posted 9 months ago
Passwords are not yet quoted in HeidiSQL's connection string, but they need to be if they contain a semicolon: http://forums.asp.net/t/1957484.aspx?Passwords+ending+with+semi+colon+as+the+terminal+element+in+connection+strings+

I'll change that but I need to test that first.
ansgar posted 9 months ago
Done in r4701. Please test and report back.

jenda86 posted 9 months ago
Hello ansgar.

Your fix helped and now Heidi connects without any issues.
Thanks for very quick fix and also for the great app!

Cheers!
kalvaro posted 9 months ago

// Quote password, just in case there is a semicolon or a double quote in it.
// See http://forums.asp.net/t/1957484.aspx?Passwords+ending+with+semi+colon+as+the+terminal+element+in+connection+strings+
if Pos('"', Parameters.Password) > 0 then
QuotedPassword := ''''+Parameters.Password+''''
else
QuotedPassword := '"'+Parameters.Password+'"';



What happens if the password has double quotes and single quotes?
ansgar posted 9 months ago
Yes that's what came into my mind as well. No clue. Microsoft does not say a word about that in their documentation.
ansgar posted 9 months ago
Oh, there is a way:

msdoc wrote: If the value contains both single-quote and double-quote characters, the quotation mark character used to enclose the value must be doubled every time it occurs within the value.


Quite much effort for just an escaping issue...

Please login to leave a reply, or register at first.