Hello,<br><br>I'm having a problem using twisted.enterprise.adbapi.<br><br>The problem has to do with the 'delay_connect' option I send with my db connection kwargs.&nbsp; I want to send sybase connection appname and hostname info.&nbsp; The only way I can do this is 
using the delayed connect option.<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<div id="mb_0">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;<br>I have the following standalone program example that works just fine:<br><br>vrdb = vr_db('billing_db', 'appname')&nbsp; &nbsp;
<br># vr_db just is a helper class for logical dbname -&gt; db connection info<br><br>db_kwargs&nbsp; = vrdb.return_kwargs()&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;<br>
<br>db_kwargs['cp_min'] = 1&nbsp; # one thread min<br>db_kwargs['cp_max'] = 1&nbsp; # one thread max&nbsp; = only one db connection<br>db_kwargs['cp_reconnect'] = 1&nbsp; # reconnect if die<br>db_kwargs['cp_noisy'] =&nbsp; 1<br>db_kwargs['delay_connect'] = 1 #&nbsp; do the delayed connect
<br>db_kwargs['cp_openfun'] = vrdb._vrdbOptions<br><br>print db_kwargs<br>dbpool = adbapi.ConnectionPool(vrdb.return_import_name(), **db_kwargs)<br><br># _vrdbOptions adds the following two things to the connection<br># 
conn.set_property
(Sybase.CS_HOSTNAME, self.hostname) <br>

# conn.set_property(Sybase.CS_APPNAME, self.appname)&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;  <br>
<br>a = storage(dbpool, d)<br>a.run()<br>reactor.run()<br><br>run does a sql query.<br><br>&nbsp;&nbsp; def run(self):<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ''' utility method if the script is called directly '''<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; self.get_campaign_info('id', 588103).addCallback(
self.print_result).addErrback(self.error_happened)<br><br>This
works fine and dandy.&nbsp; With the hostname and appname showing up in my
sp_who optput (show's you who's logged in from where with what appname
) <br><br>Now my problem is when I use the database connection part in
makeService(config) and pass a dbpool to a service, my service starts
up fine,&nbsp; but when <br>I have a database operation I get this:<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;<br><br>2006/12/07 15:46:17 PST [-] [Failure instance: Traceback: 
twisted.enterprise.adbapi.ConnectionLost:<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /usr/lib/python2.4/threading.py:422:run<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /usr/lib/python2.4/site-packages/twisted/python/threadpool.py:148:_worker<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /usr/lib/python2.4/site-packages/twisted/python/context.py:59:callWithContext
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /usr/lib/python2.4/site-packages/twisted/python/context.py:37:callWithContext<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; --- &lt;exception caught here&gt; ---<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /usr/lib/python2.4/site-packages/twisted/internet/threads.py:25:_putResultInDeferred
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /usr/lib/python2.4/site-packages/twisted/enterprise/adbapi.py:379:_runInteraction<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /usr/lib/python2.4/site-packages/twisted/enterprise/adbapi.py:64:rollback<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ]<br><br><br>So
I've reverted my code to pass db_kwargs['delay_connect'] = 0 and it's
working fine as long as I don't try the delay_connect.&nbsp;&nbsp; I'm&nbsp; hoping
someone has seen this before and can point me in the right direction.&nbsp;
I'd really like to have my appname and hostname show up on the db side.
<br><br>I'm using twisted, sybase 12.5,&nbsp; and the most recent Sybase
module.&nbsp; The only difference is the way I'm connecting is one program
is a tap created from mktap and the other a standalone script.<br><br>&gt;&gt;&gt; import Sybase
<br>&gt;&gt;&gt; Sybase.__version__<br>'0.37'<br>&gt;&gt;&gt; import twisted<br>&gt;&gt;&gt; twisted.__version__<br>'2.4.0'<br><br>Thanks<br><br>-rob<br><span class="sg"></span></div>