1. Computing
Send to a Friend via Email

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

By

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)

©2014 About.com. All rights reserved.