1 message in com.mysql.lists.plusplusPersistent connections?
FromSent OnAttachments
Bobby "Chil" Bailey06 Jul 2002 20:53 
Subject:Persistent connections?
From:Bobby "Chil" Bailey (ch@kyndig.com)
Date:07/06/2002 08:53:13 PM
List:com.mysql.lists.plusplus

Greetings,

I'm having a little trouble finding out how persistent connections are handled using the mysql++ API. In fact, I can find no mention of persistent connections at all in any of the documentation, though I might not be looking in the right place.

I need to open a connection, and be able to keep that connection alive for an extended period of time, or have a way to ensure that the connection will reconnect if it is ever disconnected.

In code, this is what I'm trying to do:

#include <mysql++>

int main( int argc, char *argv[] ) { Connection con( "mydbname", "myhostname", "myusername", "mypassword" );

while( running ) { Query query = con.query(); query << "aquery"; Result result = query.store(); ... do things with results } }

How is the connection handled in this case? I've heard from other sources that (depending on how the mysql server is configured) once you send X amount of data through the connection, the connection is closed by the server and you need to spawn a new connection. Using the above simple bit of code, however, I was able to do about 150,000 queries which retrieved roughly 30M of data, without ever getting so much as a hiccup from the program. Is this because the mysql++ api handles persistent connections already and I just didn't know it, or more to do with how my mysql server is configured? (Incidently, if it matters, my mysql server's configuration hasn't been changed from the default config. I'm running MySQL 3.23.41)

Any information would be most helpful. I'd like to know why it's behaving like it is instead of just guessing why. :)

-- Bobby "Chil" Bailey | "The only source of knowledge is experience." Coder's Repository Admin | -- Albert Einstein Customer Support | PGP Keys: http://chil.kyndig.com/pgp Server Administrator | Homepage: http://chil.kyndig.com/ (soon!)

------------------------------------------------------------------------ Kyndig.Com - Online Gaming Resource Site -- http://www.kyndig.com/

------------------------------------------------------------------------