1. Home
  2. Computing & Technology
  3. Delphi Programming

How to set up the dbGo (ADO) ConnectionString for mySQL database

By Zarko Gajic, About.com

If your database choice is mySQL and you are using dbGO (ADO) components, over mySQL ODBC 3.51 driver or MySQL Connector/ODBC 5.0, this is how your TADOConnection's ConnectionString property should look:

  • When using "ODBC 3.51 LOCAL database":

    'DRIVER={MySQL ODBC 3.51 Driver}; SERVER=localhost; DATABASE=myDatabase; USER=myUsername; PASSWORD=myPassword;OPTION=3;'

  • When using "ODBC 3.51 REMOTE database":

    'DRIVER={MySQL ODBC 3.51 Driver}; SERVER=data.domain.com; PORT=3306; DATABASE=myDatabase; USER=myUsername; PASSWORD=myPassword; OPTION=3;'

  • When using "ODBC 5.0 LOCAL database":

    'DRIVER={MySQL Connector/ODBC v5}; SERVER=localhost; DATABASE=myDatabase; UID=myUsername; PASSWORD=myPassword;OPTION=3;'

  • When using "ODBC 5.0 REMOTE database":

    'DRIVER={MySQL Connector/ODBC v5}; SERVER=data.domain.com; PORT=3306; DATABASE=myDatabase; UID=myUsername; PASSWORD=myPassword;OPTION=3;'

Note: "data.domain.com" is the name of the data server, "myDatabase" is the name of the database, "myUsername" is the name of the user, "myPassword" is the password for "myUsername"

Delphi tips navigator:
» Setting a multi-line Caption for a TLabel (at design-time)
« Universal solution to formatting values for SQL statements (issued from Delphi code)

More Delphi Programming Quick Tips
Explore Delphi Programming
About.com Special Features

Stay connected and entertained with reviews on tips on the latest HDTVs, cellphones and more. More >

Easy ways to connect two computers for networking purposes. More >

  1. Home
  2. Computing & Technology
  3. Delphi Programming
  4. Build Database Applications
  5. MySQL
  6. How to set up the dbGo (ADO) ConnectionString for mySQL database

©2009 About.com, a part of The New York Times Company.

All rights reserved.