From: Warren Young Date: August 13 2009 2:41pm Subject: Re: problem when calling mysqlpp connection object connect function after calling disconnect List-Archive: http://lists.mysql.com/plusplus/8702 Message-Id: <4A842617.6070300@etr-usa.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Wojciech Barski wrote: > On May 20, 2009, at 5:04 PM, Warren Young wrote: > >> Yes, do. I tried modifying one of the examples to bounce the connection a > few times in a few different places, and it doesn't affect anything. See the > attached patch. > > I seem to be having the same problem. The simple code like this brings the > access violation exception (on a reconnect try). I've traced it to > mysql_real_connect line in the dbdriver::connect method. I still can't reproduce it. I added these two lines to simple1.cpp, and it didn't crash: > Index: examples/simple1.cpp > =================================================================== > --- examples/simple1.cpp (revision 2561) > +++ examples/simple1.cpp (working copy) > @@ -48,9 +48,6 @@ > mysqlpp::Connection conn(false); > if (conn.connect(mysqlpp::examples::db_name, cmdline.server(), > cmdline.user(), cmdline.pass())) { > - conn.disconnect(); > - conn.connect(mysqlpp::examples::db_name, cmdline.server(), > - cmdline.user(), cmdline.pass()); > // Retrieve a subset of the sample stock table set up by resetdb > // and display it. > mysqlpp::Query query = conn.query("select item from stock"); I tried it on both Linux and Windows. Please apply the same patch to your copy of MySQL++. If it crashes, I'll need some details about the environment, since it clearly doesn't happen everywhere. If it doesn't crash, it's likely that you just didn't follow the README-Visual-C++.txt instructions carefully enough.