Jump to content

[Solved] Trouble with remote mySQL access


jackt

Recommended Posts

Hi 

I've been trying to make a windows desktop application with visual studio using C# and i'm having trouble connecting to the mySQL database. 
 
my connection string is "Database=jackt_database;Address=johnny.heliohost.org;User Id=jackt_un;Password=*******" (obviously password isn't *******)
 
the user ID has been added to the database and has been given all privileges.
I've added the wildcard "%" to the remote mySQL section to allow connections from all IP addresses. 
I've tried resetting the password and changing it in my code multiple times. 
It is 100% not the code because i have tested it using a different host and it worked.

// sql server connection here 
            string constring = "Database=jackt_database;Address=johnny.heliohost.org;User Id=jackt_un;Password=********";
            SqlConnection sqlcon = new SqlConnection(constring);
            try
            {
                sqlcon.Open();
                MessageBox.Show("sqlconnection successful");
            }
            catch (Exception error)
            {
                MessageBox.Show(error.ToString());
            }
            finally
            {
                sqlcon.Close();
            }

i get the error "a network related or instance specific error occurred while establishing a connection to SQL server. The server was not found or was not accessible. Verify that the instance name is correct and that the sql server is configured to allow remote connections." later in the error it says "the network path was not found". 

Any help would be greatly appreciated. 

 

Cheers 

Jack 

Link to comment
Share on other sites

Try using 64.62.211.131 as your host. The network path not found error makes me think maybe it's having trouble resolving the johnny.heliohost.org into a numerical IP. Also if that doesn't work can you post the full error messages rather than paraphrasing them?

Link to comment
Share on other sites

Hi 

It worked elsewhere because the other host was using microsoft SQL. wolstech's message made me double check that I was using MySQL, which I was not. My code was for Microsoft SQL. 
I have since changed the code and all works as it should. 

Thank you for your help 

 

Jack. 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...