Background: I have a friend who lets me use his MySQL database on hostedresource.com. He has successfully accessed the database with this snippet of PHP code:

mysql_connect ('dbname.db.1234567.hostedresource.com', 'dbname', 'password')

I tried to access the database with the following vb.NET code:

Imports MySql.Data.MySqlClient
Imports System.Data

Public Class classDataConnector
    Private connection As MySqlConnection

    Public Event ExceptionRaised(ByVal errormessage As String)

    Public Sub TestConnection()
        connection = New MySqlConnection
        connection.ConnectionString = "server=dbname.db.1234567.hostedresource.com;user id=dbname;password=password;database=dbname"

            MessageBox.Show("Connection Opened Successfully")
        Catch sql_error As MySqlException
            RaiseEvent ExceptionRaised("Error Connecting to Database: " & sql_error.Message)
        End Try
    End Sub
End Class

This code doesn't connect to the database. I get the following error message: "Unable to connect to any of the specified MySQL hosts." This is the same error message I get when I put random characters instead of the actual database location, although the exception is raised much faster when I do (versus the 30 seconds or more when I try to do it right).

I have searched everywhere I can find, but nobody seems to have this issue. Ragoune had a similar topic, but his code (unlike mine) actually found the database. My friend tells me that the database name and the user ID are the same.

Question: what am I doing wrong?

5 Years
Discussion Span
Last Post by trevor.hood.921

Ah, found it. The actual database host(not sure of the term?) was phpMyAdmin, which for whatever reason is just not compatible with vb.NET.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.