Hi there,
I am trying to use the C++ connector but every time I get the same error message:
"CDK Error: unexpected message"
I'm trying to connect to a MaiaDB web server. When I use C# with the .net connector it works, I had to set SslMode to None to make it work though. I also tried to set mysqlx::SessionOption::SSL_MODE to mysqlx::SSLMode::DISABLED but also no luck there. And ofcourse I tried to turn off my firewall, but this shouldn't be the problem since I was able to connect with C# .net and also the MySQL shell. Any suggestions or help?
Code:
#include "stdafx.h"
#include "database.h"
#include <mysqlx/xdevapi.h>
#include <exception>
#include <iostream>
void Database::connect()
try
{
mysqlx::Session mySession(mysqlx::SessionOption::HOST, "example.com",
mysqlx::SessionOption::PORT, 3306,
mysqlx::SessionOption::USER, "user",
mysqlx::SessionOption::PWD, "password",
mysqlx::SessionOption::DB, "database");
}
catch (const mysqlx::Error &err)
{
std::cerr << err << std::endl;
}
}
About my setup:
Windows 10
Connector/C++ 8.0.11
Visual Studio 17 (version 15.7.4)
I am trying to use the C++ connector but every time I get the same error message:
"CDK Error: unexpected message"
I'm trying to connect to a MaiaDB web server. When I use C# with the .net connector it works, I had to set SslMode to None to make it work though. I also tried to set mysqlx::SessionOption::SSL_MODE to mysqlx::SSLMode::DISABLED but also no luck there. And ofcourse I tried to turn off my firewall, but this shouldn't be the problem since I was able to connect with C# .net and also the MySQL shell. Any suggestions or help?
Code:
#include "stdafx.h"
#include "database.h"
#include <mysqlx/xdevapi.h>
#include <exception>
#include <iostream>
void Database::connect()
try
{
mysqlx::Session mySession(mysqlx::SessionOption::HOST, "example.com",
mysqlx::SessionOption::PORT, 3306,
mysqlx::SessionOption::USER, "user",
mysqlx::SessionOption::PWD, "password",
mysqlx::SessionOption::DB, "database");
}
catch (const mysqlx::Error &err)
{
std::cerr << err << std::endl;
}
}
About my setup:
Windows 10
Connector/C++ 8.0.11
Visual Studio 17 (version 15.7.4)