'Return a database connection when one becomes available.
This method blocks and should be run in a thread from the internal
threadpool. Don\'t call this method directly from non-threaded code.
Using this method outside the external threadpool may exceed the
maximum number of connections in the pool.
@return: a database connection from the pool.'

def connect(self):

    tid = self.threadID()
    conn = self.connections.get(tid)
    if (conn is None):
        if self.noisy:
            log.msg(('adbapi    connecting:    %s    %s%s' % (self.dbapiName, (self.connargs or ''), (self.connkw or ''))))
        conn = self.dbapi.connect(*self.connargs, **self.connkw)
        if (self.openfun != None):
            self.openfun(conn)
        self.connections[tid] = conn
    return conn
