MySQL Forums
Forum List  »  Connector/C++

MySQL C++ Connector won't connect - returns unrecognized or ambiguous flag
Posted by: Warren Burns
Date: March 21, 2013 01:59PM

I am creating a c++ program that will connect to an existing, live, functioning MySQL dB. I cut-n-pasted the example program in, for verifying being able to get a connection. THAT example code wouldn't compile.... so I reverted to the "complete example" program... which does compile at least. But when I run it in debug mode, it fails on the line where the driver is creating a connection. Here's the code:

//***********************************
#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)
{
cout << endl;
cout << "Running 'SELECT 'Hello World!' ยป
AS _message'..." << endl;

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

/* Create a connection */
printf("before the driver gets created\n");
driver = get_driver_instance();
printf("afer driver gets created before connection\n");
con = driver->connect("tcp://127.0.0.1:3306", "root", "");
printf("after connection created\n");
/* Connect to the MySQL test database */
con->setSchema("test");

etc.
//***************************

The only difference from the "complete example" is in the step that creates the connection from the driver, in that I have changed the pwd to be blank, because there is no pwd on this test database. The step that creates the connection, fails. It displays a window that says "Signal Caught" with text>>

Signal received: ? (Unknown signal)
For program ca2httplistener, pid 3,244

You may discard the signal or forward it and you may continue or pause the process

I am given the choice to Discard and Pause, Discard and Continue, or Forward and Continue. But no matter which choice I take, it displays:


What the heck???

Options: ReplyQuote


Subject
Views
Written By
Posted
MySQL C++ Connector won't connect - returns unrecognized or ambiguous flag
2672
March 21, 2013 01:59PM


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.