Current location: Hot Scripts Forums » Programming Languages » Windows .NET Programming » [C#] Connecting to a remote MySQL database


[C#] Connecting to a remote MySQL database

Reply
  #1 (permalink)  
Old 02-18-10, 03:27 PM
ICE16 ICE16 is offline
Newbie Coder
 
Join Date: Jun 2007
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Question [C#] Connecting to a remote MySQL database

Hi,

I'm trying to connect to a remote MySQL server using a C# application. Google found me some simple explanations, for example these two:
How to Access MySQL with C#: Using a MySQL Database with a C# Windows Application
How to connect to MySQL 5.0 using c# and mysql connector/net!
They are basically the same, they just define the connection object in different ways. Anyway, I installed MySql Connector/Net successfully, added a reference to it and added the line "using Mysql.Data.MySqlClient;" at the top. But when I ran the program, I got a runtime error saying it was "Unable to connect to any of the specified MySQL hosts". Now, the host or server I'm using is mysql8.000webhost.com (just a free server I'm using for web development), and it has been successfully tested many times with PHP applications (I can connect to it, read & write information etc.), so I guess the MySQL server itself is not the problem.

Does anyone know what the problem is?

Thanks a lot!
Reply With Quote
  #2 (permalink)  
Old 02-19-10, 09:41 AM
digioz's Avatar
digioz digioz is offline
Community VIP
 
Join Date: Oct 2003
Location: Chicago, IL
Posts: 2,171
Thanks: 3
Thanked 9 Times in 9 Posts
Your code may be 100% correct. The problem is by default most Shared Hosting Companies disable remote access to the database for security reason. If you are not sure, contact your web hosting company and ask them if they allow remote access to MySQL or not.

Pete
__________________
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 2 (0 members and 2 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
encrypting mysql database gkibria Database 2 08-27-09 09:57 AM
Connecting to a MySQL database paulmoss ASP 5 08-29-06 11:31 AM
MicroOLAP Database Designer for MySQL 1.8 Released microolap General Advertisements 1 09-20-05 10:00 AM
Clear my misunderstanding: 1 MySQL database for many programs? iKwak PHP 3 08-21-05 12:50 PM
Connecting to a MySQL database crisp PHP 5 09-23-04 10:39 PM


All times are GMT -5. The time now is 02:19 PM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.