Adding TCP Keepalive Support to DBD::Sybase perl module

ASE, DBI, Perl, Sybase Add comments

I’ve created a patch to enable support for CS_CON_KEEPALIVE (TCP keepalive packet SO_KEEPALIVE) in the DBD::Sybase v1.07 code. This will send an empty TCP keepalive ‘packet’ to the remote server.

"KeepAlive sets the value of the Sybase CT-Lib connection property CS_CON_KEEPALIVE to true or false. The default setting ensures that your connection is alive by sending packets to the database when the connection is idle. Set the value of this property to false for mobile clients that do not maintain constant connections." 

I’ve sent the patch to Michael Peppler.

[jfroebe@DBA-DEV1 DBD-Sybase-1.07-jf]$ diff dbdimp.h ../DBD-Sybase-1.07/dbdimp.h
78d77
<       char      keepalive[16];

[jfroebe@DBA-DEV1 DBD-Sybase-1.07-jf]$ diff dbdimp.c ../DBD-Sybase-1.07/dbdimp.c
1052d1051
<       extractFromDsn("keepalive=", dsn, imp_dbh->keepalive, 10);
1152,1166d1150
<
<       if (imp_dbh->keepalive[0]) {
<               int keepalive = atoi(imp_dbh->keepalive);
<
<               if (keepalive != 1) {
<                       keepalive = 0;
<               }
<
<               if(DBIc_DBISTATE(imp_dbh)->debug >= 3)
<                       PerlIO_printf(DBIc_LOGPIO(imp_dbh), "    syb_db_login() -> ct_config(CS_CON_KEEPALIVE,%d)\n", keepalive);
<
<               if((retcode = ct_config(context, CS_SET, CS_CON_KEEPALIVE, &keepalive, CS_UNUSED, NULL)) != CS_SUCCEED)
<                       warn("ct_config(CS_SET, CS_CON_KEEPALIVE) failed");
<       }
<

One Response to “Adding TCP Keepalive Support to DBD::Sybase perl module”

  1. Jason L. Froebe Says:

    Using dbcc dbtable() to determine if a database is in LOG SUSPEND

    Usually when a database runs out of log and a process enters LOG_SUSPEND, you can see this in the output of sp_who.  What happens if the process doesn’t exist?  Sometimes, Sybase ASE doesn’t properly clean up after a process exits…

Leave a Reply

WP Theme & Icons by N.Design Studio
Entries RSS Comments RSS Log in