Reputation: 693
I have just recently gotten into OpenShift, so bear with me please. I have set up a MySQL DB on my domain, and am able to add and remove items from the phpMyAdmin page. I now want to make an application on my machine, and only on my machine to connect to the DB, and be able to have read/write access. I have already made a permission set for this user, and made a C# form ready for coding. I have already performed the following:
rhc port-forward --app <my application name>
and afterwards, I recieved the following:
W:\>rhc port-forward --app <my application name>
DL is deprecated, please use Fiddle
Checking available ports ... done
Forwarding ports ...
Only one usage of each socket address (protocol/network address/port) is
normally permitted. - bind(2) while forwarding port 8080. Trying local port 8081
To connect to a service running on OpenShift, use the Local address
Service Local OpenShift
httpd 127.0.0.1:8080 => 127.3.223.1:8080
httpd 127.0.0.1:8081 => 127.3.223.3:8080
mysql 127.0.0.1:3306 => 127.3.223.2:3306
Press CTRL-C to terminate port forwarding
And so when I go back into C#, I have the following line of code:
conn = new SqlConnection("user id="+tbUser.Text+";password="+tbPass.Text+";server=127.0.0.1:3306;database=<my application name>");
conn.Open();
But I get an error on the .Open() function, saying that it cannot find the server or database. I am at a loss of what is going on.
EDIT: I thought I might as well add the error message if at all useful:
An unhandled exception of type 'System.Data.SqlClient.SqlException' occurred in System.Data.dll
Additional information: 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. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)
Upvotes: 0
Views: 298
Reputation: 1212
You should use the app url instead of the ip address, every address you listed is a loopback interface and is not representative of your application url.
Try using http://yourappdomain.rhcloud.com:3306
Upvotes: 2