Bug #4274 Problems using named pipes with MyODBC
Submitted: 24 Jun 2004 17:28 Modified: 21 Jul 2004 23:12
Reporter: Miguel Solorzano Email Updates:
Status: Closed Impact on me:
None 
Category:Connector / ODBC Severity:S1 (Critical)
Version:3.51.XX OS:Windows (Windows)
Assigned to: CPU Architecture:Any

[24 Jun 2004 17:28] Miguel Solorzano
Description:
So we've spent some time trying to get MyODBC to work with named pipes.
As long as we stay with the default name for the pipe (MySQL) everything
works as expected. When we start MySQL (4.1.2) with a different name for
the pipe (e.g. --enable-named-pipes --socket=MyPIPE), we get a "Lost
connection to MySQL server during query" upon executing SQLDriverConnect
(SERVER=.;OPTIONS=8195;SOCKET=MyPIPE).

On the other hand, when we stay with the default name when starting the
server but try to tell ODBC to use a different name for the pipe, everything works (unexpectedly), so it looks like the the ODBC driver is completely ignoring the SOCKET option thus always using the default pipe name.

The current work-around but not enough for user's needs should be
to use the option:

8192 : Connect with named pipes to a mysqld server running on NT.
65536 : Read parameters from the client and odbc groups from `my.cnf' 

so OPTIONS= 73731

and add to the my.ini file:

[client]
pipe
socket=MyPIPE

How to repeat:
see description

Suggested fix:
To handle the socket option for windows too in connect.c:

#ifdef _UNIX_
  SQLGetPrivateProfileString(dsn_ptr,"socket",
			     "", socket, sizeof(socket),"ODBC.INI");
#endi
[11 Jul 2004 20:38] Peter Harvey
Simple test program.

Attachment: test.c (text/plain), 3.48 KiB.

[11 Jul 2004 20:46] Peter Harvey
I have added fix for when doing a SQLDriverConnect() and caller wants to set a custom name for a named pipe. Fix committed to source code repository to be included in next release of MyODBC v3.51.

I have attached a simple test program. Some useful instructions may be found within the test program source file.
[21 Jul 2004 23:12] Timothy Smith
Fixed in current source code; it will be fixed in the next 3.51 release (3.51.9)
[14 Apr 2015 22:21] Denis Parnovskiy
Problem still exists in 3.51.11 and 3.51.30

Namely: SqlDriverConnect ignores SOCKET= option from connection string and always uses the pipe name from ini file (or default MySQL).

The problem doesn't exist in MyODBC 5.2