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

[VS'08 C++ ] SEHException while try connect to db (no replies)

$
0
0
cppconn 1.0.5, MySQL 5.5.1
win7x32

Hi, i have code example from MySQL Connector/C++ manual, and i'm getting SEHException while try connect to db like this:

std::auto_ptr<sql::Connection> con(driver->connect("tcp://127.0.0.1:3307", "root", "qwerty"));

C++ project compiled properly, without warnings, and all lib's linked/included.
MySQL service working fine, so i can view tables in phpMyAdmin, etc.


Any suggestions?
Thanks.


######################################
Full code:

#include "stdafx.h"
#include "Form1.h"

#include <stdlib.h>
#include <string>
#include <iostream>
#include <sstream>
#include <stdexcept>

#include "mysql_driver.h"
#include "mysql_connection.h"

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

using namespace std;
using namespace sql::mysql;
using namespace testApp;

[STAThreadAttribute]
int main(array<System::String ^> ^args)
{

Application::EnableVisualStyles();
Application::SetCompatibleTextRenderingDefault(false);

Form1 ^f = gcnew Form1();

try {

sql::Driver* driver = get_driver_instance();
std::auto_ptr<sql::Connection> con(driver->connect("tcp://127.0.0.1:3307", "root", "qwerty"));
} catch(Runtime::InteropServices::SEHException^ e){
MessageBox::Show( "Trace:"+e->Message,"DB Error", MessageBoxButtons::OK, MessageBoxIcon::Error);
}


Application::Run(f);
return 0;
};
######################################

Viewing all articles
Browse latest Browse all 527

Trending Articles