Re: MySqlException: Unable to connect to any of the specified MySQL hosts
Posted by: Four Shades
Date: March 05, 2005 06:45AM

I am getting this exact error. I have installed Connector .NET 1.0.4 with Visual Studio 2003, .NET Framework 1.1. I can connect to several MySQL servers from other clients (Navicat, PHP 4.3.10 etc) but I draw a blank with my VS .NET Win32 application using the MySQLConnection syntax:

If Trim(txtMySQLPort.Text) = "3306" Or Trim(txtMySQLPort.Text) = "" Then
strPortLiteral = ""
Else
strPortLiteral = ":" & Trim(txtMySQLPort.Text)
End If
DBConnectionString = "data source=" & txtMySQLServer.Text _
& strPortLiteral & ";" _
& "user id=" & txtMySQLLogin.Text & ";" _
& "pwd=" & txtMySQLPassword.Text & ";" _
& "database=" & txtMySQLDatabase.Text & ";"

Try
mysqlCon.ConnectionString = DBConnectionString
mysqlCon.Open()
mysqlCon.Close()

Catch ex As MySql.Data.MySqlClient.MySqlException
MessageBox.Show("MySQL Connection failed: " & ex.Message)
End Try



All the "txtssssss" fields are form variables. I notice the last answer on this thread was a few days ago. Does anyone have any ideas? If there is no answer I might have to give up and go with MyODBC.

Cheers,
4Shades

Options: ReplyQuote


Subject
Written By
Posted
Re: MySqlException: Unable to connect to any of the specified MySQL hosts
March 05, 2005 06:45AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.