Ads were blocked - no problem. But keep in mind that developing HeidiSQL, user support and hosting takes time and money. You may want to send a donation instead.

error in connecting when password contains semicolon

[expired user]'s profile image [expired user] posted 9 years ago in General Permalink
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.
[expired user]'s profile image [expired user] posted 9 years ago Permalink
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
[expired user]'s profile image [expired user] posted 9 years ago Permalink
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's profile image ansgar posted 9 years ago Permalink
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.
Code modification/commit from ansgar.becker, 9 years ago, revision 4701
Quote password in MSSQL connection string, so they may contain semicolons. See http://www.heidisql.com/forum.php?t=14753
ansgar's profile image ansgar posted 9 years ago Permalink
Done in r4701. Please test and report back.
[expired user]'s profile image [expired user] posted 9 years ago Permalink
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's profile image kalvaro posted 9 years ago Permalink
// 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's profile image ansgar posted 9 years ago Permalink
Yes that's what came into my mind as well. No clue. Microsoft does not say a word about that in their documentation.
ansgar's profile image ansgar posted 9 years ago Permalink
Oh, there is a way:

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...
daydream's profile image daydream posted 4 weeks ago Permalink

Dear Heidi team! Thank you for the beautiful product first of all! After 9 years, i want to confirm that the issue is still valid. My auto-generated 40 characters password to database contains both ' and " (and ; too) , so Heidi fails to connect to the server over ssh. DBeaver somehow manages to connect alright . Please resolve this issue sometime in future! Regards and best wishes, Albert from Kazan, Russia

ansgar's profile image ansgar posted 4 weeks ago Permalink

What's the right approach for escaping such passwords with let's say semicolon, single quote and double quote?

Would this be correct?

a'b"c;123

=> "a'b""c;123"

I guess I just have to try it out.

daydream's profile image daydream posted 4 weeks ago Permalink

I tried multiple combinations, but none worked, unfortunatelly. :(

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




Ads were blocked - no problem. But keep in mind that developing HeidiSQL, user support and hosting takes time and money. You may want to send a donation instead.