Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » C / C++ IDE (CDT) » Eclipse program crashing when connecting to MySQL Server
Eclipse program crashing when connecting to MySQL Server [message #1780631] Thu, 25 January 2018 06:18 Go to next message
Michael Varghese Thomas is currently offline Michael Varghese ThomasFriend
Messages: 6
Registered: December 2017
Junior Member
I am writing a simple program to connect to a MySQL Server hosted locally. I have ensured the server is running https://i.stack.imgur.com/qgSRD.jpg
The code I am trying to execute is the following:
void CSlaveController::fnDatabaseConnection(){

  sql::Driver *driver;
  sql::Connection *connection;
  sql::ResultSet *result;
  sql::Statement *statement;
  sql::PreparedStatement *prepared;
  driver = get_driver_instance();

  connection = driver->connect("tcp://127.0.0.1:3306","DBServer","root"); /*Where the program crashes*/

  statement = connection->createStatement();
  statement->execute("SHOW DATABASES");

  delete statement;
  delete connection;
}



One of the issues I have noticed is that the header file mysql_connection.h is not found when I run the program. When I build the project, no issue is raised.

https://i.stack.imgur.com/e5Z4z.jpg

But when I run the program, it crashes and this is what I see:

https://i.stack.imgur.com/ZFyuu.jpg

I have double checked the includes and even manually added that specific file.

https://i.stack.imgur.com/QUh2C.jpg

Any ideas on what I might be doing wrong? I apologise if there are too many images, I felt that this would be the best way to convey the most information.
Re: Eclipse program crashing when connecting to MySQL Server [message #1780993 is a reply to message #1780631] Wed, 31 January 2018 05:37 Go to previous messageGo to next message
Michael Varghese Thomas is currently offline Michael Varghese ThomasFriend
Messages: 6
Registered: December 2017
Junior Member
Any clue? Anyone?
Re: Eclipse program crashing when connecting to MySQL Server [message #1781002 is a reply to message #1780631] Wed, 31 January 2018 09:00 Go to previous messageGo to next message
Tauno Voipio is currently offline Tauno VoipioFriend
Messages: 396
Registered: August 2014
Senior Member
This is a doubly indirect method (function) call:

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

Are you sure that 'driver' and 'driver->connect' are valid pointers?




--

Tauno Voipio
Re: Eclipse program crashing when connecting to MySQL Server [message #1781004 is a reply to message #1781002] Wed, 31 January 2018 10:08 Go to previous message
Michael Varghese Thomas is currently offline Michael Varghese ThomasFriend
Messages: 6
Registered: December 2017
Junior Member
driver is a valid pointer. The get_driver_instance() call returns a non-NULL pointer. Which is why the crash after calling driver's method is confusing me
Previous Topic:[SOLVED] Eclipse CDT Cannot find library (third party libraries)
Next Topic:Empty folders from subversion project not importing
Goto Forum:
  


Current Time: Sun Aug 19 13:53:33 GMT 2018

Powered by FUDForum. Page generated in 0.02164 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top