Page 1 of 1

Unable to connect to MySQL server using mysql c++ connector

Posted: Sun Apr 28, 2013 4:03 pm
by Nishal
I would like to develop a application in c++ in which I want to use MySQL for storing data in my database. I am connecting to the database through "MySQL C++ connector 1.1.3" library....

The problem is that when the "driver->connect(--parameters--)" function is executed, the program crashes. I'm sure that the program crashes while executing this function because I've checked it by using suitable output statements...

I have already downloaded the C++ connector and set the required options in the IDE. So, there is no problem with compilation and the program building properly as well....

I'm using code::blocks 12.11 as my IDE and MinGW 4.7.1 as my compiler...

I didn't install MySQL separately. Instead, I installed the XAMPP package, of which MySQL is a part.

I feel that the error is because the program is not able to access the MySQL database because it is not installed as MySQL instead its a part of XAMPP package.

Now, I don't want to install the MySQL server separately. I want to continue with the XAMPP package itself....

Please help!!!!

Re: Unable to connect to MySQL server using mysql c++ connec

Posted: Mon May 27, 2013 12:29 pm
by evstevemd
Post backtrace and error message of the crash!

Re: Unable to connect to MySQL server using mysql c++ connec

Posted: Tue Jun 04, 2013 4:24 pm
by Nishal
Well, it's been quite a long time since I have posted this thread. I didn't get a reply for a long time. So, I tried finding it out myself and found that it was because the libmysql.dll file that is required for accessing the database was built using visual c++. But I was using mingw. Hence, I decided to go with mysql++. I have successfully built it and have been able to build programs performing required operations successfully. Anyway, I thank you for your reply and I appreciate that you did reply. =D>

Re: Unable to connect to MySQL server using mysql c++ connec

Posted: Wed Jun 05, 2013 8:25 am
by evstevemd
Nishal wrote:Well, it's been quite a long time since I have posted this thread. I didn't get a reply for a long time. So, I tried finding it out myself and found that it was because the libmysql.dll file that is required for accessing the database was built using visual c++. But I was using mingw. Hence, I decided to go with mysql++. I have successfully built it and have been able to build programs performing required operations successfully. Anyway, I thank you for your reply and I appreciate that you did reply. =D>
Sorry that no body had responded. Thats the way volunteer driven forums are.
Glad that you resolved it.
wxEnjoyIt!

Re: Unable to connect to MySQL server using mysql c++ connec

Posted: Tue Mar 04, 2014 12:19 am
by rafsanmoney
I would be glad if you could show me a step by step way of using the mysql++ library. I have built the library on mingw and have been able to connect to a database successfully. unfortunately, i connected to the database in a different way, my declaring a pointer to the Connection object. i.
mysqlpp::Connection *conn = new mysqlpp::Connection;
if i try to do it the usual way, i. e. mysqlpp::Connection con; app crashes.
even though the pointer works well for a successful connection. executing a query also crashes all the time. all the example programs crash. i don't know why, maybe you can give me an insight since i believe you are now familiar with the library.
Thanks in advance.

Re: Unable to connect to MySQL server using mysql c++ connec

Posted: Tue Mar 04, 2014 6:58 pm
by evstevemd
rafsanmoney wrote:I would be glad if you could show me a step by step way of using the mysql++ library. I have built the library on mingw and have been able to connect to a database successfully. unfortunately, i connected to the database in a different way, my declaring a pointer to the Connection object. i.
mysqlpp::Connection *conn = new mysqlpp::Connection;
if i try to do it the usual way, i. e. mysqlpp::Connection con; app crashes.
even though the pointer works well for a successful connection. executing a query also crashes all the time. all the example programs crash. i don't know why, maybe you can give me an insight since i believe you are now familiar with the library.
Thanks in advance.
If I was to give advice I would suggest you use wxDatabase. it plays well with wxWidgets!
https://github.com/mtangoo/wxDatabase

Re: Unable to connect to MySQL server using mysql c++ connec

Posted: Sun Apr 13, 2014 9:33 pm
by rafsanmoney
i opened the url and it looks like there are just source files there. should i take them and build myself or what? can you give me a little walkthrough?

Re: Unable to connect to MySQL server using mysql c++ connec

Posted: Mon Apr 14, 2014 7:51 am
by evstevemd
rafsanmoney wrote:i opened the url and it looks like there are just source files there. should i take them and build myself or what? can you give me a little walkthrough?
I was waiting for someone who had bakefiles and said would contribute. Since he had not, I need to write them and will do that when I have time.
For now you have to include sources and put right switches to your library and build it. Which backed do you plan to use? MySQL only? Which IDE do you use?

Re: Unable to connect to MySQL server using mysql c++ connec

Posted: Mon Apr 14, 2014 3:57 pm
by rafsanmoney
I use code::blocks and i want to use just mysql.