Last post Feb 12, 2018 05:26 PM by Lannie
Jan 21, 2018 07:56 PM|abfrank|LINK
I hosted a web api on a windows server that is to connect to mysql database server hosted in another server. The windows server has been give perimission to access the database and i was also able to connect the remote database using a workbench on the windows
server but if my c# api application trys to access the remote database i get the below error...
"Unable to connect to any of the specified MySQL hosts.
stacktrace at MySql.Data.MySqlClient.NativeDriver.Open()\r\n at MySql.Data.MySqlClient.Driver.Open()\r\n
at MySql.Data.MySqlClient.Driver.Create(MySqlConnectionStringBuilder settings)\r\n
at MySql.Data.MySqlClient.MySqlPool.CreateNewPooledConnection()\r\n at MySql.Data.MySqlClient.MySqlPool.GetPooledConnection()\r\n
at MySql.Data.MySqlClient.MySqlPool.GetConnection()\r\n at MySql.Data.MySqlClient.MySqlConnection.Open()\r\n
at SMSMobileApp.Controllers.SecondaryResultController.FetchCollegeResult(String sessionname, Int32 termid, String regno) in C:\\Users\\OLUWASEUN\\Documents\\Visual Studio 2017\\Projects\\SMSMobileApp\\SMSMobileApp\\Controllers\\SecondaryResultController.cs:line
BELOW IS CONNECTION STRING
<add name="smsresult" connectionString="Data Source=166.63.122.xx;port=3306;Initial Catalog=databasename;User Id=mydatabaseID;password=mypassword" />
Please i need help ...........................
Jan 25, 2018 12:39 PM|abfrank|LINK
please i still need help on this
Jan 25, 2018 08:20 PM|Lannie|LINK
Could be firewall issue with the port.
Remove the port variable from the connection string.
Sometimes there are non-printable characters in the connection string... you do not see on the screen, but they are there.
Erase and retype the connection string.
Jan 27, 2018 08:46 PM|abfrank|LINK
Thank you Lannie, i removed the port vairable but still unable to connect. Remember i was able to connect to the same database using work bench from same server where this application is failing to connect to the database.
Jan 28, 2018 12:11 AM|Lannie|LINK
Your thick client workbench app might be able to connect, but your WEB APP is going through a WEB SERVER layer like IIS 8.0 AND using an SQL client DLL. Two different situations on the same server.
One thing I do to reduce the problems in my application environment is I put my SQL client DLL in my web application BIN/ folder of the web app and make a local reference to the DLL, bypassing GAC and other factors like folder permissions external to your
Feb 12, 2018 10:46 AM|abfrank|LINK
Thank you Lannie, I have done that but to no avail, please still need help on this
Feb 12, 2018 05:26 PM|Lannie|LINK
Next it could be BITNESS issue.
Is the server 64-bit and the driver 32-bit?
if so, IIS will need to be configured to run 32-bit and the app will need compiled as 32-bit.