MySQL Forums
Forum List  »  Connector/C++

[VS'08 C++ ] SEHException while try connect to db
Posted by: Vladimir M
Date: May 20, 2012 10:30AM

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;
};
######################################

Options: ReplyQuote


Subject
Views
Written By
Posted
[VS'08 C++ ] SEHException while try connect to db
3086
May 20, 2012 10:30AM


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.