Quantcast
Channel: MySQL Forums - Connector/C++
Viewing all articles
Browse latest Browse all 527

MySQL C++ Connector won't connect - returns unrecognized or ambiguous flag (no replies)

$
0
0
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???

Viewing all articles
Browse latest Browse all 527

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>