26.1.9.5. Connecting Without a Predefined DSN
Yes. You can connect to the MySQL server using SQLDriverConnect,
by specifying the DRIVER
name field. Here are
the connection strings for MyODBC using DSN-Less connection:
For MyODBC 2.50:
ConnectionString = "DRIVER={MySQL};\
SERVER=localhost;\
DATABASE=test;\
USER=venu;\
PASSWORD=venu;\
OPTION=3;"
For MyODBC 3.51:
ConnectionString = "DRIVER={MySQL ODBC 3.51 Driver};\
SERVER=localhost;\
DATABASE=test;\
USER=venu;\
PASSWORD=venu;\
OPTION=3;"
If your programming language converts backslash followed by
whitespace to a space, it is preferable to specify the
connection string as a single long string, or to use a
concatenation of multiple strings that does not add spaces in
between. For example:
ConnectionString = "DRIVER={MySQL ODBC 3.51 Driver};"
"SERVER=localhost;"
"DATABASE=test;"
"USER=venu;"
"PASSWORD=venu;"
"OPTION=3;"
Refer to the Section 26.1.9.4, “Connection Parameters”, for the
list of connection parameters that can be supplied.