.net and mysql database connection

Hi,
need a working example of a connection between .net and mysql, mysql is located on a server over the internet, can such connection happen? i have the URL of the remote server.
do i need a special driver to do that??
Thanks
LVL 3
mte01Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

razorback041Commented:
0
tpwellsCommented:
You can use the MySql .NET connector.

http://www.mysql.com/products/connector/net/

Refence the dll to your project and add

Imports MySql.Data.MySqlClient

to the top of your .vb file

You can then open a connection like this
Dim cn as New MySqlConnection("SERVER=addressToServer;DATABASE=databasename;UID=username;PASSWORD=password")
cn.Open()

You can then create MySqlCommand object and MySqlDataReaders and MySqlDataAdapters which all behave like the standard System.Data.SqlClient / System.Data.OleDB / System.Data.ODBC providers

Hope this helps
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
tpwellsCommented:
oh the second part of your question:

you do not need extra drivers to access the server you will need the server and the port address. The above connection string:

"SERVER=addressToServer;DATABASE=databasename;UID=username;PASSWORD=password;"

uses the default port of 3306 you can specify a port by adding

Port=number;

to the string
0
mte01Author Commented:
>> razorback041,tpwells

I was able to make the connection....Thanks for your help!!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.