Reputation: 1
Im trying to connect to a mysql database running on openshift. The computer I have used is running win 10. Below is my C# code snippet of what im trying to do. The server address, password, and username have been blanked out.
string connStr = @"Server=xxxxxxx.rhcloud.com:3306;Database=hurnhusms;Uid=XXX;password=XXX;";
SqlConnection conn = new SqlConnection(connStr);
try
{
Console.WriteLine("Connecting to MySQL...");
conn.Open();
Console.WriteLine("Connection successfull !");
conn.Close();
Console.ReadLine();
}
catch (Exception ex)
{
Console.WriteLine("error => " + ex.ToString());
}
Console.ReadLine();
when I run the application all I get is:
System.Data.SqlClient.SqlException (0x80131904): 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 SQL Server is configured to allow remote connections. i have also ran rhc port-forward , i have also pinged the mysql port on the site and it is open.
Any help would be appreciate.
Upvotes: 0
Views: 156
Reputation: 1
Okay what I figured out is that I need to execute the rhc port-forward and then keep that window open (not terminate that command). I didn't realize that window need to stay open.
Upvotes: 0