driver->connect Segmentation fault
Posted by: Aaron Salo
Date: November 16, 2011 12:03PM

Hi I am running into a problem with a segmentation fault when I try to run the following c++ code on a windows machine.

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

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

using namespace std;

int main(int argc, const char *argv[]){
cout << "test";
sql::Driver *driver;
sql::Connection *con;
sql::Statement *stmt;
sql::ResultSet *res;
sql::PreparedStatement *pstmt;

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

delete con;
}catch(sql::SQLException &e){
std::cout<<e.what();
}
}

Currently this is a very basic program that I will be building off once I get this component working. From my testing I am pretty sure that the segmentation fault is being triggered by the con = driver->connect("tcp://127.0.0.1:3306", "root", "test"); line any ideas as to what could be causing it?

I am using the most recent version of the Connect/C++ library on a computer that is running windows XP professional, and I am using the g++ compiler through cygwin from with in NetBeans.



Edited 1 time(s). Last edit at 11/17/2011 09:00AM by Aaron Salo.

Options: ReplyQuote


Subject
Views
Written By
Posted
driver->connect Segmentation fault
1618
November 16, 2011 12:03PM


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.