From: David Hall Date: August 13 2009 11:20pm Subject: RE: problem when calling mysqlpp connection object connect function after calling disconnect List-Archive: http://lists.mysql.com/plusplus/8704 Message-Id: <33DF3F144AD0BA49BB315563801508E11BF308D09A@NGMAIL01.geonautics.local> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Hi Warren, it still crashes (access violation at the second connect) when y= our patch is applied (though my original version of simple1.cpp looks a lit= tle different to yours (from the 3.0.9 release I downloaded.) (with patch) =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D mysqlpp::Connection conn(false); if (conn.connect(db, server, user, pass)) { conn.disconnect(); conn.connect(db, server, user, pass); // Retrieve a subset of the sample stock table set up by re= setdb // and display it. mysqlpp::Query query =3D conn.query("select item from stock= "); if (mysqlpp::StoreQueryResult res =3D query.store()) { cout << "We have:" << endl; mysqlpp::StoreQueryResult::const_iterator it; for (it =3D res.begin(); it !=3D res.end(); ++it) { mysqlpp::Row row =3D *it; cout << '\t' << row[0] << endl; } } else { cerr << "Failed to get item list: " << query.error(= ) << endl; return 1; } //return 0; } else { cerr << "DB connection failed: " << conn.error() << endl; return 1; } conn.disconnect(); =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D My details: Using MySQL Server 5.1. I have the following Visual studio versions: - Visual studio 2003 version 7.1.6030 - Visual studio 2005 version 8.0.50727.762 (SP.050727-7600) - Visual studio 2008 version 9.0.30729.1 SP What other information would you like? Cheers, Dave -----Original Message----- From: Warren Young [mailto:mysqlpp@stripped] Sent: Friday, 14 August 2009 12:41 AM To: MySQL++ Mailing List Subject: Re: problem when calling mysqlpp connection object connect functio= n after calling disconnect 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 th= e > 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 > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > --- 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 rese= tdb > // and display it. > mysqlpp::Query query =3D 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. -- MySQL++ Mailing List For list archives: http://lists.mysql.com/plusplus To unsubscribe: http://lists.mysql.com/plusplus?unsub=3Ddavidh@geonautic= s.com