MySQLConnection.open() is not timing out accordingly to timeout parameter

Hello,
I'm developing an App that connects directly to a database via MySQLConnection Class , and eventough I set the Connect Timeout parameter at the connection string, MySqlConnection.Open() is taking too long and it's not timing out. Does anyone know why?

Here is my connection string:

MySqlConnection conexao = new MySqlConnection("Server=XXXX;Port=3306;database=XXXXXX;" +
"User Id=XXXXXX;Password=XXXXXXX;Connect Timeout=10;charset=utf8;" +
"Allow User Variables=True");

P.S: I know that connecting directly to a database is not a good practice, but that's just for personal use.

Posts

  • ricardoarraesricardoarraes USMember ✭✭

    By the way, that's the way I'm openning the connection:

    try
    {
    if (conexao.State == ConnectionState.Closed)
    {
    conexao.Open();
    }
    }
    catch(mysqlexception ex)
    {
    ....
    }

Sign In or Register to comment.