locked
Timeout in IO operation- Mysql connection RRS feed

  • Question

  • User-151352204 posted

    Timeout in IO operation

    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

    Exception Details: System.TimeoutException: Timeout in IO operation

    Code -

    string connStr = String.Format(@"Server=XX;Port=3306;Database=XX;Uid=XX;
    Pwd=Xx;"
    );
    MySql.Data.MySqlClient.MySqlConnection conn;
    string myConnectionString;

    myConnectionString = connStr;

    try
    {
    conn = new MySql.Data.MySqlClient.MySqlConnection();
    conn.ConnectionString = myConnectionString;
    conn.Open();
    }
    catch (MySql.Data.MySqlClient.MySqlException ex)
    {
    // MessageBox.Show(ex.Message);
    }

    can you tell me why?

    Thursday, July 24, 2014 2:53 PM

All replies

  • User269602965 posted

    Suspect timeout is simply a Failure to Connect and Open the database schema

    Try

    MySql.Data.MySqlClient.MySqlConnection conn;
    string myConnectionString;
    myConnectionString = "server={serverIPaddress};port=3306;database=XX;uid=XX;pwd={yourpassword}";
    
    try
    {
        conn = new MySql.Data.MySqlClient.MySqlConnection(myConnectionString);
        conn.Open();
    }
    catch (MySql.Data.MySqlClient.MySqlException ex)
    {
        MessageBox.Show(ex.Message);
    }
    

    If that fails

    You have to think of other things blocking the connection.

    Can you connect on this application server from the MySQL client command line?

    Are there firewall rules blocking the IP and Port of the database?

    are you sure the uid and password are valid?

    Thursday, July 24, 2014 6:49 PM
  • User-151352204 posted

    No i install my sql database and connect via ODBC it shows below error

    Invalid authorization specification
    Invalid connection string attribute

    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

    Exception Details: System.Data.OleDb.OleDbException: Invalid authorization specification
    Invalid connection string attribute

    Thursday, July 24, 2014 8:37 PM
  • User269602965 posted

    Okay so you are using ODBC instead of more modern connection libraries.

    Were you able to connect with the TEST in the ODBC administrator when you set up the ODBC connection?

    Thursday, July 24, 2014 10:35 PM
  • User-151352204 posted

    I can connect via DSN. But it fails via this connection string

    string ConnectionString = @"Provider=sqloledb;DRIVER={MySQL ODBC 3.51 Driver};SERVER=localhost;PORT=3306;DATABASE=TEST;USER=jihn;PASSWORD=test;OPTION=3";

    Thursday, July 24, 2014 11:05 PM
  • User1428246847 posted

    It's a while ago that I used MySQL. Can you connect using the mysql client and the same credentials? If no, some things that I can remember:

    1. Does the user exist? Can the user access the mysql server via localhost? You can check both in the user MySql 'user' table.
    2. Have you granted 'usage' privilege to the user for the specific database?

    Friday, July 25, 2014 6:54 AM
  • User269602965 posted

    Provider=sqloledb;

    remove this since you are not using OLEDB

    Friday, July 25, 2014 12:29 PM