2016-03-21 5 views
0

Wie Timeout mit mySQL C++ - Connector festlegen? Ich habe das versucht .. aber es ist Kompilierfehler.Ich brauche Beispielcode für C++ - Connector zum Festlegen von "mysql_options"

error: ‘class sql::Driver’ has no member named ‘mysql_options’ 
error: ‘MYSQL_READ_DEFAULT_FILE’ was not declared in this scope 

Code ist hier.

driver = get_driver_instance(); 
driver->mysql_options(MYSQL_READ_DEFAULT_FILE, "/my.cnf"); 
con = driver->connect(host, user, password); 

ich lesen Sie diese Seite (http://dev.mysql.com/doc/refman/5.0/en/mysql-options.html) aber Diese Seite hat keine C++ "Beispiel" ...

Ich brauche Hilfe!

Antwort

1

Ich finde einen Weg für mich selbst ..:) es hat gut funktioniert.

driver = get_driver_instance(); 

    sql::ConnectOptionsMap connection_properties; 
    connection_properties ["hostName"] = host; 
    connection_properties ["userName"] = user; 
    connection_properties ["password"] = password; 
    connection_properties ["OPT_CONNECT_TIMEOUT"] = 10; 
    con = driver->connect(connection_properties); 
Verwandte Themen