Bug #43575 Unable to send Port = - 1 when the connection is only via named pipes
Submitted: 12 Mar 2009 0:12 Modified: 20 Apr 2009 13:26
Reporter: Manuel Rodriguez Email Updates:
Status: Closed Impact on me:
None 
Category:Connector / NET Documentation Severity:S2 (Serious)
Version:5.2.5.0 OS:Windows
Assigned to: Tony Bedford CPU Architecture:Any

[12 Mar 2009 0:12] Manuel Rodriguez
Description:
Very Srs. mine: I have detected a bug in Connector-net 5.2.5.0
The problem is when trying to connect via named pipes on Windows XP only.
Having configured the Server in the my.ini file as:
#Don't allow connections via TCP/IP.
skip-networking
#Allow connections via named pipes (Windows NT+ only).
enable-named-pipe
# The Pipe the MySQL Server will use
socket=mysql
Sending the sequence:
...MySqlConnection("Server=localhost;Database=XXX;UserID=root;
Password=1111;Port= -1;Pipe Name=mysql")
The compiler emits an error because the variable is UINT Port numbers can not sign -
If we change the line to avoid the error:
...MySqlConnection("Server=localhost;Database=XXX;UserID=root;
Password=1111;Pipe Name=mysql")
Unable to connect to the server rejects.
According to instructions in the manuals when the connection is named pipes Port= -1; value
Please, can change in a variable UINT port to int port?

Please Can not send data: Port = -1 can not make connections in this situation:
#Don't allow connections via TCP/IP.
skip-networking
#Allow connections via named pipes (Windows NT+ only).
enable-named-pipe
Where networking is everything is very well connected 
#skip-networking
¡Connection OK!

Thank you very much for your attention.
Yours sincerely
Manuel Rodriguez
Spain

How to repeat:
namespace MySql.Data.MySqlClient
{
    /// <include file='docs/MySqlConnectionStringBuilder.xml' path='docs/Class/*'/>
    public sealed class MySqlConnectionStringBuilder : DbConnectionStringBuilder
    {
        private static Dictionary<Keyword, object> defaultValues = new Dictionary<Keyword, object>();

        string userId, password, server;
        string database, sharedMemName, pipeName, charSet;
        readonly string originalConnectionString;
        readonly StringBuilder persistConnString;
        """uint port""", connectionTimeout, minPoolSize, maxPoolSize;

Suggested fix:
MySqlConnectionStringBuilder.cs:

namespace MySql.Data.MySqlClient
{
    /// <include file='docs/MySqlConnectionStringBuilder.xml' path='docs/Class/*'/>
    public sealed class MySqlConnectionStringBuilder : DbConnectionStringBuilder
    {
        private static Dictionary<Keyword, object> defaultValues = new Dictionary<Keyword, object>();

        string userId, password, server;
        string database, sharedMemName, pipeName, charSet;
        readonly string originalConnectionString;
        readonly StringBuilder persistConnString;
        int port; 
        uint connectionTimeout, minPoolSize, maxPoolSize;
[12 Mar 2009 10:51] Tonci Grgin
Hola Manuel.

Thanks for spotting this. Truly, manual states:
http://dev.mysql.com/doc/refman/6.0/en/connector-net-using-connecting.html
Port: The port MySQL is using to listen for connections. Default is 3306. Specify -1 for this value to use a named-pipe connection.

while latest 5.2 code (MySqlConnectionStringBuilder.cs, LN 41) states:
        uint port, connectionTimeout, minPoolSize, maxPoolSize;

Verified as described by looking into code/manual. Reggie, if it's documentation error please assign Tony to fix.
[30 Mar 2009 21:05] Reggie Burnett
This is a bug in our docs.  To specify and named pipe connection the user would include 'connection protocol=pipe' in their connection string.  The other values for connection protocol are memory, unix, and socket (or tcp)
[20 Apr 2009 13:26] Tony Bedford
The documentation has been corrected, these changes should be reflected in the online manual within 24 hours. Thank you.