Details
-
New Feature
-
Status: Closed (View Workflow)
-
Minor
-
Resolution: Fixed
-
None
-
None
-
None
Description
MYSQL * mysql_real_connect_dsn(MYSQL * mysql, const char * connection_string)
Would be nice to have such an alternative way to connect to a database.
That code exists in the ODBC connector already.
So I guess it is not a hard task to port it into the C connector.
We shouldn't add a new API function, since mysql_real_connect supports connection plugins.
With a new connection plugin "dsn", which parses dsn strings, the call would look like:
mysql_real_connect(mysql, "dsn://host=192.168.3.1;user=foo;password=bar;port=3307", NULL, NULL., NULL, 0, NULL, flags);
ODBC doesn't support several settings that needs to be set via mysql_options, so I would suggest to use the key-values from my.cnf (there can be additional aliases).