jackt Posted February 5, 2018 Posted February 5, 2018 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
Krydos Posted February 5, 2018 Posted February 5, 2018 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?
jackt Posted February 6, 2018 Author Posted February 6, 2018 I tried replacing the host with the IP you gave, but it gives the same error. See the attached image for the full error message. Thanks for your help
Krydos Posted February 6, 2018 Posted February 6, 2018 my connection string is "Database=jackt_database;Address=johnny.heliohost.org;User Id=jackt_un;Password=*******" (obviously password isn't *******)Does it work if you put UID=jackt_un; instead of User ID=jackt_un; ?
wolstech Posted February 6, 2018 Posted February 6, 2018 Are you sure this worked elsewhere? The SQLConnection object is usually for Microsoft SQL Server, not MySQL...we don't offer Microsoft SQL Server. 1
jackt Posted February 7, 2018 Author Posted February 7, 2018 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.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now