[freetds] FeeTDS 0.60 getting killed in continuous operation

Abhinkar, Sameer sameer.abhinkar at intel.com
Tue May 6 13:21:54 EDT 2003


Hi, 

I am connecting through the FreeTDS 0.60 to a SQL Server 2000 machine. I
don't do anything but just dbinit() and dbexit() in a continuous operation
and it fails after sometime (~ 5-10mins). I am attaching the sample code -
please let me know what could possibly go wrong.

Thanks, 

Sameer 

============================================================================
======= 

#include <stdio.h> 
#include <sqldb.h> 
#include <time.h> 

// Forward declarations of the error handler and message handler. 
int err_handler(DBPROCESS*, int, int, int, char *, char *); 
int msg_handler(DBPROCESS*, DBINT, int, int, char *, char *, 
                char *, DBUSMALLINT); 
int run(); 

int main() { 
    time_t t1; 
    printf("Start Time=%ld\n", (t1=time(&t1))); 
    while (1) run(); 
} 
int run() 
{ 
    // Initialize DB-Library. 
    dbinit (); 
    dbexit (); 
    return 1; 
} 

int err_handler (DBPROCESS *dbproc, int severity, 
    int dberr, int oserr, char * dberrstr, char * oserrstr) 
{ 
    printf ("DB-Library Error %i: %s\n", dberr, dberrstr); 
    if (oserr != DBNOERR) 
    { 
        printf ("Operating System Error %i: %s\n", oserr, oserrstr); 
    } 
    return (INT_CANCEL); 
} 

int msg_handler (DBPROCESS *dbproc, DBINT msgno, int msgstate, 
    int severity, char * msgtext, char * server, 
    char * procedure, DBUSMALLINT line) 
{ 
    printf ("SQL Server Message %ld: %s\n", msgno, msgtext); 
    return (0); 
} 





More information about the FreeTDS mailing list