Quantcast
Channel: MySQL Forums - Connector/C++
Viewing all 529 articles
Browse latest View live

Problem with C++ Connector (no replies)

$
0
0
Sorry, mi english is not very good, i've got this problem:
I'm using QT Creator and I am trying to make a conection between C++ and MySQL.

My code:

#include "mainwindow.h"
#include "ui_mainwindow.h"

#include <mysql_connection.h>
#include <cppconn/driver.h>
#include <cppconn/resultset.h>

#include <cppconn/statement.h>
#include <cppconn/exception.h>

MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
}

MainWindow::~MainWindow()
{
delete ui;
}

void MainWindow::on_pushButton_clicked()
{
sql::Driver *driver;
sql::Connection *connection;
sql::Statement *statement;
sql::ResultSet *resultset;

driver = get_driver_instance();
connection = driver->connect("tcp://127.0.0.1:331", "root", "");

connection->setSchema("remiseria");

statement = connection->createStatement();
resultset = statement->executeQuery("INSERT INTO city(name) VALUES ('villaguay') ");

delete resultset;
delete statement;
delete connection;

}


When I Run and Compile:

C:\Users\Pablo\Desktop\Remises\build-untitled-Desktop_Qt_5_3_MinGW_32bit-Debug\debug\mainwindow.o:-1: In function `ZN10MainWindow21on_pushButton_clickedEv':

C:\Users\Pablo\Desktop\Remises\untitled\mainwindow.cpp:32: error: undefined reference to `_imp__get_driver_instance'

collect2.exe:-1: error: error: ld returned 1 exit status

Thanks for your helps.

MySQL connector c/c++ and MinGW (no replies)

$
0
0
Hi,

I need to access an MySQL database from a Code:Blocks/MinGW project on Windows. As far as I know I can't use the available binary versions of the MySQL connectors. Well, I followed mainly the descriptions here: http://forums.mysql.com/read.php?117,425191,425191 and here: http://forums.mysql.com/read.php?117,426293,426927
But neither works. It begins with a missing BOOST which I got installed then. But then it complains about a missing mysql_config. The description says "mysql_config needs to be in PATH for the configuration to work". But unfortunately there is only a mysql_config.pl. I've even tried several versions of MinGW and/or MSYS but neither works. Every combination gives different errors but all have in common that they fail. Well, all in all I've spent about 25-30 hours this week on this topic without success. What can I do?

Best regards
Simon

MySQL connector with MinGW and WxWidgets (no replies)

$
0
0
Hello,

it seems that my former posting from friday isn't in the forums. Thus here is a new.

I need to write a Windows GUI applcation with MinGW/Cygwin which acts as a MySQL database client. As far as I understood I have to use the conncetor c/c++ and can't use neither from the binaries but have to compile them myself. Latter is what gives me headaches since more than a week now. The combination seem to be rather rare and there are just a few instruction (http://forums.mysql.com/read.php?117,426293,426927 and http://forums.mysql.com/read.php?117,425191,425191#msg-425191), but neither works. I've tried with MinGW, Cygwin and MSYS.

Latter instructions says: "Compiling mysql connector c++ works analogous to mysql connector c except that mysql_config needs to be in PATH for the configuration to work." Well, despite of the issue that the conncetor C doesn't build, there is no "mysql_config" on Windows. I have a "mysql_config.pl" only which doesn't seem to be compatible. In addition "boost" is needed but that is only a minor issue.

Here is what happens when I try to build the c++ connector...
D:\mysql-connector-c++-1.1.0>cmake -G "MinGW Makefiles"
CMake Warning (dev) in CMakeLists.txt:
Syntax Warning in cmake code at

D:/mysql-connector-c++-1.1.0/CMakeLists.txt:225:24

Argument not separated from preceding token by whitespace.
This warning is for project developers. Use -Wno-dev to suppress it.

CMake Warning (dev) in CMakeLists.txt:
Syntax Warning in cmake code at

D:/mysql-connector-c++-1.1.0/CMakeLists.txt:225:54

Argument not separated from preceding token by whitespace.
This warning is for project developers. Use -Wno-dev to suppress it.

-- The C compiler identification is GNU 4.9.1
-- The CXX compiler identification is GNU 4.9.1
-- Check for working C compiler: D:/MinGW/mingw32/bin/gcc.exe
-- Check for working C compiler: D:/MinGW/mingw32/bin/gcc.exe -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: D:/MinGW/mingw32/bin/g++.exe
-- Check for working CXX compiler: D:/MinGW/mingw32/bin/g++.exe -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Environment compile flags:
-- Environment link flags:
-- Boost version: 1.56.0
-- BOOST_INCLUDE_DIRS=d:/boost_1_56_0
-- ENV{MYSQL_DIR} = D:\mysql
CMake Error at FindMySQL.cm:215 (MESSAGE):
mysql_config wasn't found, -DMYSQL_CONFIG_EXECUTABLE=...
Call Stack (most recent call first):
CMakeLists.txt:166 (INCLUDE)


CMake Error at FindMySQL.cm:217 (MESSAGE):
Cannot find MySQL. Include dir: D:/mysql/include library dir: cxxflags:
Call Stack (most recent call first):
CMakeLists.txt:166 (INCLUDE)


-- Configuring incomplete, errors occurred!
See also "D:/mysql-connector-c++-1.1.0/CMakeFiles/CMakeOutput.log".
See also "D:/mysql-connector-c++-1.1.0/CMakeFiles/CMakeError.log".

D:\mysql-connector-c++-1.1.0>


Here is what comes when I try to compile the c connector:
D:\mysql-connector-c-6.0.2.mingw-port>make
Scanning dependencies of target vio
[ 0%] Building C object vio/CMakeFiles/vio.dir/vio.c.obj
In file included from D:/mysql-connector-c-6.0.2.mingw-port/include/my_sys.h:36:
0,
from D:\mysql-connector-c-6.0.2.mingw-port\vio\vio_priv.h:21,
from D:\mysql-connector-c-6.0.2.mingw-port\vio\vio.c:23:
D:/mysql-connector-c-6.0.2.mingw-port/include/my_pthread.h:85:8: error: redefini
tion of 'struct timespec'
struct timespec {
^
In file included from D:/MinGW/mingw32/i686-w64-mingw32/include/sys/stat.h:26:0,

from D:/mysql-connector-c-6.0.2.mingw-port/include/config-win.h
:41,
from D:/mysql-connector-c-6.0.2.mingw-port/include/my_global.h:
74,
from D:\mysql-connector-c-6.0.2.mingw-port\vio\vio_priv.h:19,
from D:\mysql-connector-c-6.0.2.mingw-port\vio\vio.c:23:
D:/MinGW/mingw32/i686-w64-mingw32/include/sys/types.h:89:8: note: originally def
ined here
struct timespec {
^
In file included from D:/mysql-connector-c-6.0.2.mingw-port/include/my_sys.h:36:
0,
from D:\mysql-connector-c-6.0.2.mingw-port\vio\vio_priv.h:21,
from D:\mysql-connector-c-6.0.2.mingw-port\vio\vio.c:23:
D:/mysql-connector-c-6.0.2.mingw-port/include/my_pthread.h:121:0: warning: "ETIM
EDOUT" redefined
#define ETIMEDOUT 145 /* Win32 doesn't have this */
^
In file included from D:/mysql-connector-c-6.0.2.mingw-port/include/my_global.h:
468:0,
from D:\mysql-connector-c-6.0.2.mingw-port\vio\vio_priv.h:19,
from D:\mysql-connector-c-6.0.2.mingw-port\vio\vio.c:23:
D:/MinGW/mingw32/i686-w64-mingw32/include/errno.h:183:0: note: this is the locat
ion of the previous definition
#define ETIMEDOUT 138
^
D:\mysql-connector-c-6.0.2.mingw-port\vio\vio.c: In function 'vio_new':
D:\mysql-connector-c-6.0.2.mingw-port\vio\vio.c:167:20: warning: variable 'r' se
t but not used [-Wunused-but-set-variable]
ulong arg=0, r;
^
make[2]: *** [vio/CMakeFiles/vio.dir/vio.c.obj] Fehler 1
make[1]: *** [vio/CMakeFiles/vio.dir/all] Fehler 2
make: *** [all] Fehler 2

D:\mysql-connector-c-6.0.2.mingw-port>

It is pretty frustrating that neither instructions works. I even tried different combinations of MinGW/MSYS and their versions.

Any idea or is there a more recent manual?

Best
Simon

mysqlcppconn.dll is missing (1 reply)

$
0
0
Hi guys !
i'm new on using mysql with c++ and i am having a lot of problems to run the sample.
After to much research, now i can compile, but when i try to run my app its says that mysqlcppconn.dll is missing.
I already tried to copy this dll located on mysql folder to my program folder and its didn't solve
Tried to use regsvr32 to add in windows dlls and says that dllRegisterServer was not found but was loaded ...
anyone can help-me to fix it fast please ?

it's very important to my graduation process and i already am late with it in a week

THX

Connecting via oledb? (no replies)

$
0
0
Trying to connect to MySQL from C++/ATL via OLEDB.
Is this possible?

Attempting to use MySQLProv as provider. Problem is it seems to be missing.
My environment:
MySQL 5.7
Workbench 6.2
MySQL .NET connector 6.9.4 installer says that it's installed.

Is it not supported anymore? It seems that earlier versions had it, am I wrong?

Fill.DataSet according to Combobox->Items (Windows Form app) (no replies)

$
0
0
Hi All,

Does anyone know from the below code, why my data table is not refreshed and updated accordingly, each time a combobox item is selected?

Any feedback would be very appreciated.

Cheers


private: System::Void btnconn_Click(System::Object^ sender, System::EventArgs^ e) {
if (cbbf->Items[0]=="items1")
{
String^ constring=L"Data Source=localhost;Port=3306;username=root;password=xxxx";
MySqlConnection^ conDataBase=gcnew MySqlConnection(constring);
MySqlCommand^CmdDataBase = gcnew MySqlCommand("select * from world.city",conDataBase);

try{
conDataBase->Open();
MySqlDataAdapter^sda= gcnew MySqlDataAdapter();
sda->SelectCommand=CmdDataBase;
DataTable^dbdataset=gcnew DataTable();
sda->Fill(dbdataset);
BindingSource^bSource=gcnew BindingSource();
bSource->DataSource=dbdataset;
dtGrid->DataSource=bSource;
//sda->Update(dbdataset);

}
catch(Exception^ex) {
MessageBox::Show(ex->Message);
}

}
else if (cbbf->Items[1]=="items2")
{
String^ constring=L"Data Source=localhost;Port=3306;username=root;password=xxxx";
MySqlConnection^ conDataBase=gcnew MySqlConnection(constring);
MySqlCommand^CmdDataBase = gcnew MySqlCommand("select * from world.country",conDataBase);

try{
conDataBase->Open();
MySqlDataAdapter^sda= gcnew MySqlDataAdapter();
sda->SelectCommand=CmdDataBase;
DataTable^dbdataset1=gcnew DataTable();
sda->Fill(dbdataset1);
BindingSource^bSource=gcnew BindingSource();
bSource->DataSource=dbdataset1;
dtGrid->DataSource=bSource;
sda->Update(dbdataset1);

}
catch(Exception^ex) {
MessageBox::Show(ex->Message);
}

}
else if (cbbf->Items[2]=="items3")
{
String^ constring=L"Data Source=localhost;Port=3306;username=root;password=xxxx";
MySqlConnection^ conDataBase=gcnew MySqlConnection(constring);
MySqlCommand^CmdDataBase = gcnew MySqlCommand("select * from sakila.actor",conDataBase);

try{
conDataBase->Open();
MySqlDataAdapter^sda= gcnew MySqlDataAdapter();
sda->SelectCommand=CmdDataBase;
DataTable^dbdataset2=gcnew DataTable();
sda->Fill(dbdataset2);
BindingSource^bSource=gcnew BindingSource();
bSource->DataSource=dbdataset2;
dtGrid->DataSource=bSource;
sda->Update(dbdataset2);

}
catch(Exception^ex) {
MessageBox::Show(ex->Message);
}

}
}

How to use MySQL in C++ without libmysql.dll (no replies)

$
0
0
Hi guys,

How I use Mysql in a software C++ without libmysql.dll?, When I execute the .exe it's necessary libmysql.dll

Show a error.

Err: MySQL_CONNECTION::setReadOnly() in C++ application (no replies)

$
0
0
Hi, I'm new to Mysql. I tried to compile and run the example source code from Mysql website. The code is listed below:

#include "mysql_connection.h"
#include <cppconn/driver.h>
#include <cppconn/exception.h>
#include <cppconn/resultset.h>
#include <cppconn/statement.h>
using namespace std;

#define EXAMPLE_HOST "localhost"
#define EXAMPLE_USER "root"
#define EXAMPLE_PASS "get your own password here"
#define EXAMPLE_DB "information_schema"

int main(int argc, const char **argv)
{
const string url(argc >= 2 ? argv[1] : EXAMPLE_HOST);
const string user(argc >= 3 ? argv[2] : EXAMPLE_USER);
const string pass(argc >= 4 ? argv[3] : EXAMPLE_PASS);
const string database(argc >= 5 ? argv[4] : EXAMPLE_DB);

try {
sql::Driver *driver;
sql::Connection *con;
sql::Statement *stmt;
sql::ResultSet *res;

driver = get_driver_instance(); /* Create a connection */
con = driver->connect("tcp://" + url + ":3306", user, pass);
con->setSchema(database); /* Set the database */

stmt = con->createStatement();
res = stmt->executeQuery("SELECT 'Hello World!' AS _message");

while (res->next())
{
cout << "\t... MySQL replies: ";
cout << res->getString("_message") << endl;
cout << "\t... MySQL says it again: ";
cout << res->getString(1) << endl;
}
delete res;
delete stmt;
delete con;
} catch (sql::SQLException &e) {
/*
The MySQL Connector/C++ throws three different exceptions:

- sql::MethodNotImplementedException (derived from sql::SQLException)
- sql::InvalidArgumentException (derived from sql::SQLException)
- sql::SQLException (derived from std::runtime_error)
*/
cout << "# ERR: SQLException in " << __FILE__;
cout << "(" << __FUNCTION__ << ") on line " << __LINE__ << endl;
/* Use what() (derived from std::runtime_error) to fetch the error message */
cout << "# ERR: " << e.what();
cout << " (MySQL error code: " << e.getErrorCode();
cout << ", SQLState: " << e.getSQLState() << " )" << endl;

return EXIT_FAILURE;
}
return EXIT_SUCCESS;
}

The program compile and run correctly if I remove the line:
con->setSchema(database); /* Set the database */
It doesn't work if I run the application with the line above, with the error:
ERR: MySQL_Connection::setREADONLY()

May I know why?

Connector C++ with Eclipse MinGW on Windows (no replies)

$
0
0
Hello,

are the C++ connector sources available? I need to recompile them for Eclipse MinGW under Windows (the download distributions does not contain sources, and they are compiled with MS VS).

If not available, do you offer any alternative for the above platform/tools ?

Regards
Peter

Application crashes when retrieving a string thats longer as 15 Characters (no replies)

$
0
0
Hey,

Everythings works fine when i retrieve a < 15 Char String.

but when i try to get a string thats longer as 15 chars my application crashes / toggles a Breakpoint.

I'm using Visual Studio 2013 Community Edition.

while (res->next()) {
			*Active = res->getInt("active");
			*id = res->getInt("id");
			*username = res->getString("name");
			*Sub = res->getString("sub"); // Crash
			stringstream stmtvar;
			stmtvar << GetMySQLStatement2() << date << "' WHERE hwid = '"<< hwid <<"'";
			stmt->executeUpdate(stmtvar.str());
			delete res;
			delete stmt;
			delete con;
			return MYSQL_RETURN_SUCCESSFULL;
		}


best regards: Max

MYSQL replication: ADO Programming in C++ (no replies)

$
0
0
Hi,

I developed a code in C++ to connect to MYSQL using ADODB.
I am using pConnection->BeginTrans() before doing any insert/delete/update operation.

pConnection is _ConnectionPtr. Complete code is given below

After the successful operation I am doing pConnection->CommitTrans(), incase of failure I am calling pConnection->RollbackTrans() to revert those operation.
I am able to connect to MySQL database and also able to perform some insert/update/delete operation.

But in case of MYSQL replication scenario, it is not working. Insert/update/delete operation is failing. If I remove the pConnection->BeginTrans(), then it is working fine.
The probelm is BeginTrans(). Could anyone guide me how to proceed with BeginTrans() function? or Do I need to modify any settings in .ini?
kindly provide solution for this issue.

Thanks,
Vinoth

<Code>


#import "C:\Program Files (x86)\Common Files\System\ado\msado60.tlb" rename("EOF", "adoEOF") //modified for TFS defect-737814
#import "C:\Program Files (x86)\Common Files\System\ADO\msadox.dll"

using namespace ADODB;
using namespace ADOX;

int _tmain(int argc, _TCHAR* argv[])
{
::CoInitialize(NULL);
_ConnectionPtr pConnection = NULL;
_CommandPtr pCmdChange = NULL;
bstr_t strCnn = L"Driver={MySQL ODBC 5.2w Driver};Server=localhost;Database=test;User=root;Password=****;Option=8;charset=utf8;no_ssps = 1";
//bstr_t strSQLChange = L"INSERT INTO \`newtable\` (\`IntVal\`, \`FloatVal\`, \`StringVal\`) VALUES (12, 12.3, \'Hello\')";
bstr_t strSQLChange = L"INSERT INTO `newtable` (`IntVal`, `FloatVal`, `StringVal`) VALUES (12, 12.3, 'Hello')";

HRESULT hRes = pConnection.CreateInstance(__uuidof(Connection));
pConnection->Open (strCnn, "", "", adConnectUnspecified);

VARIANT varValue;
::VariantInit(&varValue);

_RecordsetPtr ptrRec;

pConnection->BeginTrans();

//ptrRec = pConnection->Execute(strSQLChange, &varValue, adCmdText|adExecuteNoRecords/*, &ptrRec*/);

HRESULT hr = pConnection->raw_Execute(strSQLChange.copy(false), &varValue, adCmdText|adExecuteNoRecords, &ptrRec);

pConnection->CommitTrans();

//pConnection->RollbackTrans();

pConnection->Close();

pConnection.Release();

::CoUninitialize();

return 0;
}



<Code>

libmysqlcppconn.so.7: cannot open shared object file: No such file or directory (1 reply)

$
0
0
Hello Everyone !

First, i'm sorry about my language, but i'm french, so i hope that i will be understand...

I'm working on Ubuntu with the IDE "Eclipse-CDT" in language C++.
I'm trying to make an application who will connect me on my Mysql database.
So i dowloaded the mysqlconnector c++, and i started to write my code, all seems to work, the compilation is OK, but i've god an error :

/home/developpeur/Documents/workspace/Test/Debug/Test: error while loading shared libraries: libmysqlcppconn.so.7: cannot open shared object file: No such file or directory

I never worked on linux so i don't understand it, is it like a DLL in Windows ?
How can i fix it ? I tried to paste the libmysqlconn.so.7 file in all directories, but it still blocking me...

Please i need your help :)

"mysql_real_escape_string" in Connector/C++ (no replies)

$
0
0
Which function is use to translation the escape character in Connector/C++?

How to run SQL script file through MySQL Connector/C++ (no replies)

$
0
0
I am just wondering if is there any way to run a script file (containing SQL statements) through MySQL Connector/C++ ?

(As an alternative I can invoke mysql to run script in typical manner. But for that I got to install mysql on the system where my application runs. I don't want to have that dependency. It would be great if this Connector/C++ library or by any other means it can be done)

MySQL C++ Connector and thread detached (no replies)

$
0
0
Hello,

I've recently started to use MySQL C++ Connector for a multithreaded application.

The scenario is pretty simple: at a given time a connection will be made and passed to a newly created thread that will make some database operations using that connection and the thread will exit. I verified my application for races and other multithreading problems using valgrind with helgrind tool and I saw that were reported a lot of possible races.

After much digging I found that the problem occurs when the thread is not joined. In my application, the driver is initialized once with get_driver_instance() and used to create the connections. The created connection is passed to the thread. The thread is created and then detached (pthread_detach()). It does it's job and deletes the connection.

I modified the example pthreads.cpp to not wait for the thread via join(), but to detach the thread and the waiting will still be made by a while loop which checks a thread_finished variable that is set to 1 at the end of thread execution.

// status = pthread_join(thread_one, NULL);
// if (status != 0)
// throw std::runtime_error("Joining thread has failed");
pthread_detach(thread_one);

This modification triggers the same race problems when the example is analized with helgrind.

My question is why the races are still present and how can I fix them?

I don't want to use thread join because of the design of the application (it just spawns the threads at specific times and lets them do their job; any error will be logged and analized later).

Thank you,
Adrian

connecting to MySql server using Visual Studio 2013 Unhandled Exception (no replies)

$
0
0
After trawling the web for hours on end to run a program that using the MySql C++ connector library, I finally managed it. But all of a sudden, with no changes to the project's `Properties`, file paths/locations/names, I am now getting the exception of:

> Unhandled exception at 0x7278AF68 (msvcr90.dll) in MySqlTest.exe: 0xC0000005: Access violation reading location 0x736F686C.

Which in `Release` mode occurs on the line:

con = driver->connect("tcp://127.0.0.1:3306", "localhost", "")

and in `Debug` mode on this line:

std::cout << res->getString("_message") << std::endl;

The only change I made was to try and `INSERT` a value into a table as a test. It didn't work, but when I tried to retrace my steps, the exception shown above started appearing.

The code that I am using (that ran initially) is from the MySql Usage Exmaple 1 (http://dev.mysql.com/doc/connector-cpp/en/connector-cpp-examples-complete-example-1.html):


#include <cppconn/driver.h>
#include <cppconn/exception.h>
#include <cppconn/resultset.h>
#include <cppconn/statement.h>

int main()
{
std::cout << "Running 'SELECT 'Hello World!' AS _message'..." << std::endl;
try {
sql::Driver *driver;
sql::Connection *con;
sql::Statement *stmt;
sql::ResultSet *res;
/* Create a connection */
driver = get_driver_instance();
con = driver->connect("tcp://127.0.0.1:3306", "localhost", "");
/* Connect to the MySQL test database */
con->setSchema("test");

stmt = con->createStatement();
res = stmt->executeQuery("SELECT 'Hello World!' AS _message");
while (res->next()) {
std::cout << "\t... MySQL replies: ";
/* Access column data by alias or column name */
std::cout << res->getString("_message") << std::endl;
std::cout << "\t... MySQL says it again: ";
/* Access column fata by numeric offset, 1 is the first column */
std::cout << res->getString(1) << std::endl;
}
delete res;
delete stmt;
delete con;
}
catch (sql::SQLException &e) {
std::cout << "# ERR: SQLException in " << __FILE__;
std::cout << "(" << __FUNCTION__ << ") on line " << __LINE__ << std::endl;
std::cout << "# ERR: " << e.what();
std::cout << " (MySQL error code: " << e.getErrorCode();
std::cout << ", SQLState: " << e.getSQLState() << " )" << std::endl;
}
return EXIT_SUCCESS;
}

Anyone know what is the issue here? I've had 2 days worth of pain regarding trying to get this to work already...

Inheritance (no replies)

$
0
0
Is multiplae inheritance is benificial or this is a disadvantage of C++?

Unable to Manage Transactions (no replies)

$
0
0
I am new to MySql. I have been using SqlLite. Using C++/Qt on Windows.
I seem to have no problems selecting, updating, inserting. I have moved much code from SqlLite to MySql with no problem except one. I cannot get transactions to work. It acts as if AutoCommit is on always. If I begin a transaction, encounter an error and then rollback, nothing gets rolled back.

My initial investigation pointed to the Server configuration whether or not my tables are InnoDB. They are. I then ran the same sql code from the WorkBench 6.3 CE and my transactions work. So, I believe the Server is set up correctly.

From my C++ code, when I ask the MySql driver if it has transaction support, it comes back false. Really, I am using Qt to ask the driver and it returns false. When I look into the Qt code for that, it is looking for CLIENT_TRANSACTIONS.

I am using the MySql Driver from my install directory Program Files (x86)\MySQL\MySQL Connector C 6.1\lib\libmysql.dll

Again, everything seems to work fine except transactions.

Can you help me move forward with this?
thanks.

C++ connector example run segment fault (1 reply)

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

Mysql Connector c++ Run with Qt - Mingw (1 reply)

$
0
0
Hi all,

To use the connector with qt and mingw , you must compile with mingw ??? You can not use the binary website.

Thx.
Viewing all 529 articles
Browse latest View live


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