Bug #105259 Not able to connect to MySQL hosted over AZURE or AWS using isql command.
Submitted: 19 Oct 2021 7:12 Modified: 17 May 2022 21:17
Reporter: Akash More Email Updates:
Status: Closed Impact on me:
None 
Category:Connector / C++ Severity:S3 (Non-critical)
Version:8.0.26 OS:Linux (Linux PSLinuxmysql03 4.18.0-193.47.1.el8_2.x86_64)
Assigned to: CPU Architecture:x86 (x86_64 x86_64 x86_64 GNU/Linux)
Tags: AWS Aurora, Azure, isql, socket

[19 Oct 2021 7:12] Akash More
Description:
We are not able to connect to MySQL hosted over AZURE or AWS using isql command if SOCKET field is present in ODBC.ini.
Issue encounters for connector version higher than 8.0.18.
Currently, we are testing this over RHEL-8 and connector versions available for MySQL are available onwards 8.0.17.
Subjected issue is not being encountered for 8.0.17 and 8.0.18.
All the versions above 8.0.18(8.0.19 to 8.0.26) are having the issue. 
Issue is being encountered only if DB is hosted remotely.
If we remove SOCKET field from ODBC.ini, isql command is able to connect to SQL server hosted remotely.
Simulation Steps are mentioned below.

How to repeat:
1. Install mysql-connector-odbc with version 8.0.26
2. Configure remote host in odbc.ini as below
[pslmysqlauroradb02]
Driver       = /usr/lib64/libmyodbc8w.so
Description  = MySQL ODBC 8.0 Unicode Driver
SERVER = pslmysqlauroradb02.cluster-cihp157rpcvu.us-west-1.rds.amazonaws.com
PORT = 3306
USER = USERNAME
Password = XXXXXX
Database = sp_ol03
OPTION = 3
SOCKET       = /var/lib/mysql/mysql.sock
3. Drivers are properly configured in odbcinst.ini.
4. Check mysql odbc version
[XXXX@Hostname mysql]$ rpm -aq | grep odbc | grep mysql
mysql-connector-odbc-8.0.26-1.el8.x86_64
5. Connect using isql prompt 
[qarun@PSLinuxmysql03 ~]$ isql pslmysqlauroradb02 USERNAME XXXXXX
[ISQL]ERROR: Could not SQLConnect
6. Remove SOCKET field from odbc.ini
[pslmysqlauroradb02]
Driver       = /usr/lib64/libmyodbc8w.so
Description  = MySQL ODBC 8.0 Unicode Driver
SERVER = pslmysqlauroradb02.cluster-cihp157rpcvu.us-west-1.rds.amazonaws.com
PORT = 3306
USER = USERNAME
Password = XXXXXX
Database = sp_ol03
OPTION = 3
7. Connect using isql prompt 
[qarun@PSLinuxmysql03 etc]$ isql pslmysqlauroradb02 USERNAME XXXXXX
+---------------------------------------+
| Connected!                            |
|                                       |
| sql-statement                         |
| help [tablename]                      |
| quit                                  |
|                                       |
+---------------------------------------+

Suggested fix:
Above explained issue only encounters with connector version higher than 8.0.18.
[25 Oct 2021 12:12] MySQL Verification Team
Hello Akash,

Thank you for the bug report.
Specifying SERVER that is not localhost and SOCKET at the same time is a wrong configuration. 
The ODBC driver prefers SOCKET file connection if the corresponding option is specified.
After discussing internally with the developer we concluded that this looks like more of a documentation improvement request.
To avoid ambiguities in the future it should be documented. Hence verifying as a doc bug. Thank you!

Regards,
Ashwini Patil
[17 May 2022 21:17] Philip Olson
Posted by developer:
 
Sorry for the late response, this bug was lost over time... partially due to it being a C/ODBC bug listed against C/C++. 

The socket documentation was clarified; only define socket if server is localhost.