Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.datemas.de!rt.uk.eu.org!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.004 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'subject:not': 0.03; 'cursor': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'thread': 0.14; '(just': 0.16; 'adapter': 0.16; 'received:80.91.229.3': 0.16; 'received:dip0.t-ipconnect.de': 0.16; 'received:plane.gmane.org': 0.16; 'received:t-ipconnect.de': 0.16; 'subject:Problems': 0.16; 'subject:object': 0.16; 'subject:threads': 0.16; 'threads,': 0.16; 'threads.': 0.16; 'weird': 0.16; 'result.': 0.19; 'header:User-Agent:1': 0.23; 'header:X-Complaints-To:1': 0.27; 'errors': 0.30; 'apparently': 0.31; 'relational': 0.31; 'writes:': 0.31; 'open': 0.33; 'maybe': 0.34; 'subject:from': 0.34; 'subject:with': 0.35; 'connection': 0.35; 'but': 0.35; '(we': 0.36; '+0200,': 0.36; 'charset:us- ascii': 0.36; 'should': 0.36; 'being': 0.38; 'to:addr:python- list': 0.38; 'does': 0.39; 'subject:can': 0.39; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'called': 0.40; 'received:217': 0.63; 'skip:n 10': 0.64; 'here': 0.66; 'between': 0.67; 'study': 0.69; 'actually,': 0.84; 'transactions': 0.91 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: dieter Subject: Re: Problems with ZODB, I can not persist and object accessed from 2 threads Date: Wed, 07 May 2014 08:48:29 +0200 References: <87iopjyxsj.fsf@handshake.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Gmane-NNTP-Posting-Host: pd9e0ac36.dip0.t-ipconnect.de User-Agent: Gnus/5.1008 (Gnus v5.10.8) XEmacs/21.4.22 (linux) Cancel-Lock: sha1:Otl2uTqHPIpxRoW4W1MM9I5tqEc= X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 21 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1399445324 news.xs4all.nl 2851 [2001:888:2000:d::a6]:46946 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:71009 Dennis Lee Bieber writes: > On Tue, 06 May 2014 13:03:08 +0200, dieter declaimed > the following: > >> >>The database (we have called it "db") is global to all threads. >>Each thread must open (and maybe close) its own connection to the >>global database. You must never share the same connection or >>objects loaded via the connection between threads - very weird >>(and apparently non-deterministic) errors can result. >> > Actually, one should study the documentation for the dbapi adapter > being used -- some may allow the connection (db = adapter.connect(...)) to > be shared by threads, but require each thread to create its own cursor (cur > = db.cursor()) We are speaking here about the ZODB (= "Zope Object DataBase"). This is not a relational database - and does not have cursors (just databases, transactions and connections).