Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7942145
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T23:52:45+00:00 2026-06-03T23:52:45+00:00

I am trying to use the MySQL C++ Connector to connect to a database.

  • 0

I am trying to use the MySQL C++ Connector to connect to a database. I have added the libraries and the source code compiles correctly with all the necessary #include statements. The code I am using is the following:

#include <stdlib.h>
#include <iostream>

#include "mysql_connection.h"

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

using namespace std;

int main(void)
{
    using namespace sql;

    Driver *driver;
    Connection *con;

driver = get_driver_instance();
con = driver -> connect("tcp://127.0.0.1:3306/test", "test", "test");
}

The code is taken right from the examples and should work properly. I have shortened the code significantly, as it is at the final “driver -> connect” line where the error is thrown. My error message is the following:

*** glibc detected *** /home/username/NetBeansProjects/mysql/dist/Release/GNU-Linux-x86/mysql:
free(): invalid pointer: 0x091dd468 ***

I’m on Linux Mint Lisa, running the latest version of MySQL and using NetBeans 7.1 as an IDE. As mentioned, the code compiles correctly, and it is on this last connection line where the error occurs. Any help or recommendations for another connection mechanism would be much appreciated.


UPDATE

Here is the code from the Driver class where the connection is defined

class CPPCONN_PUBLIC_FUNC Driver
{
protected:
virtual ~Driver() {}
public:
// Attempts to make a database connection to the given URL.

virtual Connection * connect(const sql::SQLString& hostName, const sql::SQLString& userName, const sql::SQLString& password) = 0;

virtual Connection * connect(ConnectOptionsMap & options) = 0;

...

Nothing to see there… in my humble opinion…

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T23:52:46+00:00Added an answer on June 3, 2026 at 11:52 pm

    I have found the solution to this problem for Ubuntu 12.04, it has taken me about 48 hours of no sleep but ok, here goes. Im sure this fix will work for other versions of Ubuntu.
    Download the libstdc++.so.5 from http://www.sopcast.com/download/libstdcpp5.tgz. You need to extract and place the files in /usr/lib.

    Make sure you add -llibstdc++.so.5 when building your app with g++ ( this links stdc++ v5)

    Then Google ‘Connector c++ Ubuntu 12.04’ and look for the Builds and download the .deb for your Arch.

    For Ubuntu 12.04 here is the URL for the .debs
    https://launchpad.net/ubuntu/precise/+source/mysql-connector-c++/+builds
    Choose your arch ie. Amd64 and download the two .debs under the Built Files. Open and install using the package manager. You should be able to run you app now without and issues.

    EDIT
    You do not need to link libstdc++.so.5, you might have to on your system but on Ubuntu 12.04 amd64 its not needed.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to use sqlalchemy to connect with mysql database. I have set
I have connected to a mysql database and I am trying to use jquery
I'm trying to use odbc to connect some erlang code to a mysql server.
I am trying to use MySql Connector 6.2.2.0 for membership and role providers. The
I'm trying to use MySQL (5.5.22, Connector 6.5.4) with Entity Framework 4. I'm using
I am trying to connect to MySQL database with Java and I get the
I am trying to connect to a MYSQL database using VB.NET to handle some
I am trying to insert data in table in mysql database through php code
I have a program that uses MySQL connector to talk to a MySQL database.
Below is the code I have been trying to use to delete a row

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.