Click here to Skip to main content
15,896,435 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am working on a website in VS 2010 and need to connect to mysql to perfrom some db operation. I used .net connector 6.6.5 to connect with mysql.

Coded like this
C#
MySql.Data.MySqlClient.MySqlConnection con = new MySql.Data.MySqlClient.MySqlConnection();
      con.ConnectionString = "Server=mashroob.mobi;Port=2082;Database=mashroob_virtualbartender;Uid=mashroob_sandy;password=sandy@123;Charset=utf8;AllowUserVariables=True;PersistSecurityInfo=false;Pooling=true;";
        con.Open();


and get following timeout exception
"A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond"
Posted
Comments
Shubham Choudhary 12-Mar-13 4:12am    
Hi!!! if you use mysql database so add reference of mysql connector in your project
mayankkarki 12-Mar-13 5:09am    
I already added reference of MySql.Data
CHill60 12-Mar-13 13:19pm    
Try adding Connection Timeout=15; to the end of your connection string
mayankkarki 13-Mar-13 2:25am    
I added connect timeout but now getting different error "connection terminated unexpectedly.". I tried with different versions of .net connectors 6.1.6, 6.3.9 and 5.1.7 but getting same error message.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900