MySQL Query executes but throws exception

后端 未结 3 556

My code:

try {
    sql::Driver *driver;
    sql::Connection *con;
    sql::Statement *stmt;

    /* Create a connection */
    driver = get_driver_instance()         


        
3条回答
  •  星月不相逢
    2021-01-11 19:38

    I recently had the situation that a query resulted in an exception with error code 0 and sql status 1000. It's probably not the issue you had, but in case someone stumbles across this thread while trying to figure out something similar here's what solved it for me:

    The whole reason I kept getting this error was that the log files written by the Java connector (the client-side slow query log and the performance metrics log) were created by the wrong user so that my process wasn't allowed to overwrite them. To be fair this resulted in a warning during startup, but I didn't expect an exception every time the connector tried to write to the log.

    So this would be an example where an exception with error code 0 can in fact be seen as a warning that could be ignored (like Jesse's answer quoted from the MySQL reference).

    By the way: status code 0 means successful completion (just like MySql error code 0) and status code 1000 means "warning" (https://docs.oracle.com/cd/F49540_01/DOC/server.815/a58231/appd.htm).

提交回复
热议问题