Bug #45378 | SQLDriverConnect can't connect to DB with connection string | ||
---|---|---|---|
Submitted: | 8 Jun 2009 16:11 | Modified: | 24 May 2010 12:23 |
Reporter: | York Lo | Email Updates: | |
Status: | Closed | Impact on me: | |
Category: | Connector / ODBC | Severity: | S2 (Serious) |
Version: | 5.1.5 | OS: | Linux (RedHat EL v3) |
Assigned to: | CPU Architecture: | Any |
[8 Jun 2009 16:11]
York Lo
[10 Jun 2009 7:24]
Tonci Grgin
Hi York and thanks for your report. Just a few quick questions. Does "normal" user have the *same* name as MySQL user? Are you sure you have only libodbcinst library? It appears to me your compile command would failed in that case...
[10 Jun 2009 13:43]
York Lo
Hi Tonci, Normal user is not the same as MySQL user. In my testing case, the "normal" user is ncdev, and MySQL's user is nervectr. For compiling/linking, it is used the libs from /usr/local/lib. To ensure that I am using the right libs, I modified the g++ command line as following: g++ -ggdb -L/opt/OSInc/db/lib -lodbc -lodbcinst test.cpp after compile, the following is the ldd result: ldd a.out libmyodbc5-5.1.5.so => /opt/OSInc/db/lib/libmyodbc5-5.1.5.so (0x00627000) libodbcinst.so.1 => /opt/OSInc/db/lib/libodbcinst.so.1 (0x00838000) libstdc++.so.5 => /usr/lib/libstdc++.so.5 (0x00da9000) libm.so.6 => /lib/tls/libm.so.6 (0x00b44000) libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x00fc7000) libc.so.6 => /lib/tls/libc.so.6 (0x00111000) libdl.so.2 => /lib/libdl.so.2 (0x003cf000) libcrypt.so.1 => /lib/libcrypt.so.1 (0x00249000) libnsl.so.1 => /lib/libnsl.so.1 (0x00f15000) libpthread.so.0 => /lib/tls/libpthread.so.0 (0x003f4000) /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x00517000) Again, if I am invoking the program as root, I am still getting the same error as I had reported. Are you able to see the same problem? Thank you for all helps. York
[10 Jun 2009 13:59]
Tonci Grgin
Thanks for info provided, looking into this.
[16 Jun 2009 12:04]
Jess Balint
fix + test
Attachment: bug45378.diff (text/x-diff), 3.08 KiB.
[13 Aug 2009 21:27]
Jess Balint
This needs an additional fix to prevent a problem when the value is only spaces: === modified file 'util/installer.c' --- util/installer.c 2009-06-16 11:58:20 +0000 +++ util/installer.c 2009-08-13 21:26:24 +0000 @@ -953,7 +953,7 @@ /* remove trailing spaces on value (not escaped part) */ len = end - split - 1; - while (split[len] == ' ' && split[len+1] != '}') + while (end > split && split[len] == ' ' && split[len+1] != '}') { len--; end--;
[25 Feb 2010 4:39]
Russell Levy
I am getting a strange error on W2K on a connection string that works perfectly in XP, Vista, 7, etc. When I removed the spaces between semicolons and the next attribute from connection string, it worked. Even though I was not connecting to localhost, the error message was "Can't connect to MySQL server on 'localhost'". Would I be correct to assume that this patch will correct the problem?
[25 Feb 2010 9:26]
Lawrenty Novitsky
yes, that is correct assumption.
[24 May 2010 12:23]
Tony Bedford
An entry has been added to the 5.1.7 changelog: If an application was invoked by the root user, SQLDriverConnect() was not able to use the username and password in the connection string to connect to the database.