2 Replies - 5974 Views - Last Post: 28 December 2012 - 10:47 PM Rate Topic: -----

#1 hapkidoin  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 27-December 12

ASP.NET with VB.NET, trying to connect to remote MySQL database

Posted 27 December 2012 - 10:29 PM

I have many years of experience with VB.NET but I am relatively new to ASP.NET. This is my first post here.

I am trying to connect to a remote MySQL database with an ASP.NET page with VB.NET code behind it and I am having all kinds of strange problems. I think all I need is to get the connection string right. This example includes all of the options I have been trying:

MySQLconn = New MySqlConnection("server=mysql.mydomain.com;port=3306;user=username;pwd=password;database=databasename;pooling=false;")


Tried "user", "user id" and "uid"
Tried "password" and "pwd"
Tried with and without the port
Tried with and without the pooling (without setting it to false, I get all kinds of other errors)
Tried with database and without</div> <div>Tried with "mysql.mydomain.com" and "mydomain.com"
Tried with different databases, different users, changing those users' passwords (yes, I was grasping at straws...)</div>

I get:

MySql.Data.MySqlClient.MySqlException (0x80004005): Unable to connect to any of the specified MySQL hosts. at MySql.Data.MySqlClient.NativeDriver.Open() at MySql.Data.MySqlClient.Driver.open() at MySql.Data.MySqlClient.Driver.Create(MySqlConnectionStringBuilder settings) at MySql.Data.MySqlClient.MySqlConnection.Open() at button_click_event(Object sender, EventArgs e) in code_filename:line 70 at server=mysql.mydomain.com;database=database;user=username;password=password;pooling=false

I can connect to this database with PHP and I can ping mysql.mydomain.com, yet I cannot telnet the server nor have I gotten it to connect with ASP.NET. I have been on Google and all over the internet for DAYS and I am slowly going insane...

Can anyone offer me any assistance? I would be MOST appreciative.

Humbly,

Shaun




Is This A Good Question/Topic? 0
  • +

Replies To: ASP.NET with VB.NET, trying to connect to remote MySQL database

#2 _HAWK_  Icon User is online

  • Master(Of Foo)
  • member icon

Reputation: 1062
  • View blog
  • Posts: 4,144
  • Joined: 02-July 08

Re: ASP.NET with VB.NET, trying to connect to remote MySQL database

Posted 28 December 2012 - 06:48 PM

Where is the Db located? It should be on the server where you host your Aspx pages. The hosting company should have a connection string for accessing it - or maybe that's just mine.
Was This Post Helpful? 0
  • +
  • -

#3 hapkidoin  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 27-December 12

Re: ASP.NET with VB.NET, trying to connect to remote MySQL database

Posted 28 December 2012 - 10:47 PM

Hawk:

Thank you so much for responding. I finally got in touch with someone at my hosting company tonight who could actually tell me something about it. It had something to do with a very strange DNS issue...

There are several acceptable connection strings, but the most basic have always worked for me. As soon as the DNS issue was resolved, the nice easy one worked for me. While these do not have to be in the exact order listed, the connection string that worked for me is:

"Server=[server name];Database=[database name];Uid=[username];Pwd=[password];"

Again, thank you for your response. Have a great weekend and a happy and safe New Year!

Shaun
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1