MySQL Forums
Forum List  »  Connector/C++

C++ connector example run segment fault
Posted by: jianfei zheng
Date: September 21, 2015 08:08PM

hi,i counter a problem,which i don't know how to deal with it.

code is from the example website, just with a little change to pass the compile,but when i run ,i got a segment fault :
libcoretls_record.a"
warning: Could not open OSO archive file "/BinaryCache/coreTLS/coreTLS-35.30.2~2/Symbols/BuiltProducts/libcoretls_stream_parser.a"

Program received signal SIGSEGV, Segmentation fault.
0x00007fff88fe6b22 in std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(std::string const&) () from /usr/lib/libstdc++.6.dylib
(gdb) bt
#0 0x00007fff88fe6b22 in std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(std::string const&) () from /usr/lib/libstdc++.6.dylib
#1 0x000000010001930c in sql::Variant::Variant(sql::SQLString const&) ()
from /Users/apple/program/program/libmysqlcppconn.7.1.1.6.dylib
#2 0x000000010000bf69 in sql::mysql::MySQL_Connection::MySQL_Connection(sql::Driver*, sql::mysql::NativeAPI::NativeConnectionWrapper&, sql::SQLString const&, sql::SQLString const&, sql::SQLString const&) ()
from /Users/apple/program/program/libmysqlcppconn.7.1.1.6.dylib
#3 0x000000010001aa3b in sql::mysql::MySQL_Driver::connect(sql::SQLString const&, sql::SQLString const&, sql::SQLString const&) () from /Users/apple/program/program/libmysqlcppconn.7.1.1.6.dylib
#4 0x000000010000169d in main () at cpluswrapper.cpp:26


the source code happens here ,

0 sql::mysql::MySQL_Driver *driver;
21 //sql::Connection *con;
22 sql::Statement *stmt;
23 sql::ResultSet *res;
24
25 driver = sql::mysql::get_mysql_driver_instance();
26 std::auto_ptr<sql::Connection> con (driver->connect(sql::SQLString("tcp://rdsu091ibn2lcl30bs00public.mysql.rds .aliyuncs.com:3306"), sql::SQLString("ruhnn18"), sql::SQLString("ruhnn1818")));
27 con->setSchema("ruhnn");
28
29

is there something wrong with my code?
Thanks for the help.

Options: ReplyQuote


Subject
Views
Written By
Posted
C++ connector example run segment fault
3377
September 21, 2015 08:08PM


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.