.net and mysql database connection

Posted on 2006-03-28
Last Modified: 2012-05-05
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??
Question by:mte01
    LVL 5

    Assisted Solution

    LVL 10

    Accepted Solution

    You can use the MySql .NET connector.

    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")

    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
    LVL 10

    Assisted Solution

    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:


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


    to the string
    LVL 3

    Author Comment

    >> razorback041,tpwells

    I was able to make the connection....Thanks for your help!!

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Do You Know the 4 Main Threat Actor Types?

    Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

    I think the Typed DataTable and Typed DataSet are very good options when working with data, but I don't like auto-generated code. First, I create an Abstract Class for my DataTables Common Code.  This class Inherits from DataTable. Also, it can …
    The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (…
    how to add IIS SMTP to handle application/Scanner relays into office 365.
    In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

    759 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    10 Experts available now in Live!

    Get 1:1 Help Now