c# - MySQL connector timeout when opening the connection -


i have following class:

public class mysqlconnectionmanager {     public mysqlconnection connection { get; set; }      public void openconnection()     {         connection = new mysqlconnection(getconnectionstring());         try         {             connection.open();         }         catch (mysqlexception exc)         {             switch (exc.number)             {                 case 0:                     throw new exception("cannot connect mysql-server. please contact administrator.");                 case 1045:                     throw new exception("invalid username/password connect mysql-server. please correct data.");                 default:                     throw new exception("unknown mysql-connection error. code: " + exc.number);             }         }     }      private string getconnectionstring()     {         string activedatabaseserver;         string activedatabasename;         string activedatabaseusername;         string activedatabasepassword;          #if debug             activedatabaseserver = debugdatabaseserver;             activedatabasename = debugdatabasename;             activedatabaseusername = debugdatabaseusername;             activedatabasepassword = debugdatabasepassword;         #else             activedatabaseserver = releasedatabaseserver;             activedatabasename = releasedatabasename;             activedatabaseusername = releasedatabaseusername;             activedatabasepassword = releasedatabasepassword;         #endif          string connectionstring = "server=" + activedatabaseserver + ";uid=" + activedatabaseusername + ";pwd=" +                                   activedatabasepassword + ";database=" + activedatabasename + ";";          return connectionstring;     } 

when connection.open() called, timeout exception. setting timeout 120 seconds didn't help. debug database works (it's locally). exception when in release mode. i'm sure name of server, database, username , password correct because i'm using same database application written in php working fine.

the password contains special characters '!', '%', '*', '.' or '@'. cause trouble?

my code runs on external system. it's not possible connect 1&1 hosted mysql-database outside. :(


Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

thorough guide for profiling racket code -