List:MySQL++« Previous MessageNext Message »
From:Attila Date:January 16 2009 6:29pm
Subject:Connect exception
View as plain text  
Hi All,

I am trying to detect if a connection is down and then reconnect.
Here's my offending code that causes an exception on the second connect()
call:

(Using VC++ 2008)


// test.cpp : Defines the entry point for the console application.
//
#include <mysql++.h>
#include <iostream>
//#include <vld.h>

int main(int argc, char* argv[])
{

    mysqlpp::Connection pConn(false);

    if (!pConn.connect("vc", "localhost", "root","root"))
    {
        std::cout << "not" << std::endl;
    }
    pConn.disconnect();

    if (!pConn.connect("vc", "localhost", "root","root"))
    {
        std::cout << "not" << std::endl;
    }
    std::cout << "end" << std::endl;
    std::string s;
    std::cin >> s;
    return 0;
}

The exception received is access violation 0x0 (See screenshot attachment)
in VC/include/xutility

Call stack:

     libmysql.dll!10009f40()
     [Frames below may be incorrect and/or missing, no symbols loaded for
libmysql.dll]
     libmysql.dll!1000cdd5()
>    test.exe!std::_Container_base_secure::_Orphan_all()  Line 226 + 0x17
bytes    C++
     0012fd00()
     test.exe!_Mtxlock(_RTL_CRITICAL_SECTION * _Mtx=0x0012f950)  Line 45
C


Any ideas why I would get a problem with calling connect() ?

Thanks,


-- 
Attila
Software Developer
atteeela@stripped

Attachment: [text/html]
Thread
Connect exceptionAttila16 Jan
  • Re: Connect exceptionWarren Young16 Jan
    • Re: Connect exceptionAttila16 Jan