0

I am getting the following error when running under Ubuntu 16.04.

C++ terminate called after throwing an instance of 'std::length_error', what(): basic_string::_M_create

When I run under Ubuntu 15.04 the code runs fine.

The gdb trace I have isolated it to the following code: https://i.stack.imgur.com/g5Yzb.jpg

Somewhere around the connect it's generating the error.

#define DBHOST "tcp://127.0.0.1:3306"
#define USER "root"
#define PASSWORD " "
#define DATABASE "db_mmofps"

void CDBMySQL::Connect()
{
     m_driver = mysql::get_mysql_driver_instance();
     m_con = m_driver->connect(DBHOST, USER, PASSWORD);
     m_con->setSchema(DATABASE);
 }

Any ideas why its throwing the error? It's something simple I'm sure that I have overlooked.

Langerz
  • 71
  • 1
  • 5
  • did you try to set a password other than a blank space? – xmoex Jun 28 '16 at 07:52
  • the password sould be blank ive left mysql as root, password blank. When I make it "" without a space, it's the same error. thanks. – Langerz Jun 28 '16 at 07:57
  • I'd suggest to turn it into 1234 for example just to make sure the error doesn't come from a malformed password – xmoex Jun 28 '16 at 08:15
  • Tried re-installing with a common password and it still errors with the length_error. – Langerz Jun 28 '16 at 13:48

1 Answers1

0

Worked out the issue. The libmysqlcppconn libraries needed replacing from the working ones in Ubuntu 15.04. Hope this saves someone a headache.

Langerz
  • 71
  • 1
  • 5