Hi,

I took the HelloWorld.cpp example for SQLDBC and added a loop that Connected/Executed/Disconnected and after about 1400-2000 or so iterations it will die with:

Connecting to the database failed Connection failed (RTE:could not connect to socket [10048])

Then it won't reconnect for anywhere from 10-60 seconds (sometimes 1-10 connects will work right after the failure but then it gets the same error and will take usually about 60 seconds until I can get another ~1700 connects to work before it fails again.

In knldiag I see lots of messages like this:
2004-09-27 12:32:53 0x2F0 19651 CONNECT Connection released, T22
2004-09-27 12:32:53 0x2F0 19633 CONNECT Connect req. (T22, Node:'127.0.0.1', PID:8792)
2004-09-27 12:32:53 0x2F0 19677 CONNECT Client has released connection, T22


Below I have included the simplest version to reproduce this error. I'm making the connects to localhost not from a remote machine.

Thanks,

Adam Wendt
IPCoast, Inc.


#include "SQLDBC.h" #include "stdio.h"

typedef struct ConnectArgsT {
   char * username;
   char * password;
   char * dbname;
   char * host;
} ConnectArgsT;

static void parseArgs (ConnectArgsT * connectArgs, int argc, char **argv);

using namespace SQLDBC;

int main(int argc, char *argv[])
{
  ConnectArgsT connectArgs;
  parseArgs (&connectArgs, argc, argv);

  char errorText[200];

SQLDBC_IRuntime *runtime;
runtime = SQLDBC::GetClientRuntime(errorText, sizeof(errorText));
if (!runtime) {
fprintf(stderr, "Getting instance of the ClientRuntime failed %s", errorText);
return (1);
}
SQLDBC_Environment env(runtime);


  SQLDBC_Connection *conn = env.createConnection();
  SQLDBC_Statement *stmt;

SQLDBC_Retcode rc;

int i;
for(i = 0; i < 5000; i++)
{
rc = conn->connect(connectArgs.host, connectArgs.dbname,
connectArgs.username, connectArgs.password);
if(SQLDBC_OK != rc) {
fprintf(stderr, "Connecting to the database failed %s", conn->error().getErrorText());
return (1);
}


stmt = conn->createStatement();
rc = stmt->execute("SELECT 'Hello world' from DUAL");
if(SQLDBC_OK != rc) {
fprintf(stderr, "Execution failed %s", stmt->error().getErrorText());
return (1);
}


rc = conn->disconnect();
if(SQLDBC_OK != rc) {
fprintf(stderr, "Disconnect failed %s\n", conn->error().getErrorText());
return (1);
}



fprintf(stderr, "%d\n", i); } fprintf(stderr, "Done.\n"); /* * Finish your program with a returncode. */ return 0; }

static void parseArgs (ConnectArgsT * connectArgs, int argc, char **argv)
{
   /*
    * setting defaults for demo database
    */
   connectArgs->username = (char*)"TEST";
   connectArgs->password = (char*)"TEST";
   connectArgs->dbname = (char*)"TST";
   connectArgs->host = (char*)"localhost";
   /*
    * use values from command line
    */
   if (argc > 4) {
       connectArgs->host = argv [4];
   }
   if (argc > 3) {
       connectArgs->dbname = argv [3];
   }
   if (argc > 2) {
       connectArgs->password = argv [2];
   }
   if (argc > 1) {
       connectArgs->username = argv [1];
   }
}



--
MaxDB Discussion Mailing List
For list archives: http://lists.mysql.com/maxdb
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]



Reply via email to