Quantcast
Channel: MySQL Forums - Connector/C++
Viewing all articles
Browse latest Browse all 527

std::bad_alloc thrown on attemt to setSchema (1 reply)

$
0
0
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.

Viewing all articles
Browse latest Browse all 527

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>