MySQL Forums
Forum List  »  Connector/C++

std::bad_alloc thrown on attemt to setSchema
Posted by: Doug Livesey
Date: June 11, 2016 06:31PM

Hi -- I have this really simple code:

auto mysql_driver = get_driver_instance();
sql::Connection *c = mysql_driver->connect("172.17.0.1", "root", "tooth");
c->setSchema("mysql");
delete c;

That is generating this error:

terminate called after throwing an instance of 'std::bad_alloc'
what(): std::bad_alloc
Aborted

The following command however works in the terminal:
$ mysql -h 172.17.0.1 -u root -ptooth mysql

If I comment out the line with the call to setSchema() in it, no error is thrown, so it looks like the first attempt to (presumably lazy-) use the connection is causing the error.

I'm on linux, and installed Connector/C++ from the tar file.

Could anybody please advise me on what is going wrong, here? I've been trying to fix this for hours, now, but to no avail.
Thanks in advance for any & all assistance,
Doug.

Options: ReplyQuote


Subject
Views
Written By
Posted
std::bad_alloc thrown on attemt to setSchema
1169
June 11, 2016 06:31PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.