Return-Path: X-Original-To: apmail-cayenne-user-archive@www.apache.org Delivered-To: apmail-cayenne-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 35983933F for ; Wed, 11 Jan 2012 14:54:02 +0000 (UTC) Received: (qmail 53177 invoked by uid 500); 11 Jan 2012 14:54:02 -0000 Delivered-To: apmail-cayenne-user-archive@cayenne.apache.org Received: (qmail 52965 invoked by uid 500); 11 Jan 2012 14:54:00 -0000 Mailing-List: contact user-help@cayenne.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@cayenne.apache.org Delivered-To: mailing list user@cayenne.apache.org Received: (qmail 52957 invoked by uid 99); 11 Jan 2012 14:53:59 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 11 Jan 2012 14:53:59 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=5.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: local policy) Received: from [208.78.103.231] (HELO vorsha.objectstyle.org) (208.78.103.231) by apache.org (qpsmtpd/0.29) with SMTP; Wed, 11 Jan 2012 14:53:52 +0000 Received: (qmail 13951 invoked from network); 11 Jan 2012 14:53:31 -0000 Received: from unknown (HELO ?192.168.1.79?) (194.158.197.10) by vorsha.objectstyle.org with SMTP; 11 Jan 2012 14:53:31 -0000 Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Apple Message framework v1084) Subject: Re: Working with DataContext after manipulating datasource From: Andrus Adamchik In-Reply-To: Date: Wed, 11 Jan 2012 17:53:29 +0300 Content-Transfer-Encoding: quoted-printable Message-Id: <7D30384D-3F24-4F99-BD88-E7F5FFAB98B1@objectstyle.org> References: To: user@cayenne.apache.org X-Mailer: Apple Mail (2.1084) Hi Daniel, Since DataSource is attached to the DataNode, which is one of the shared = parts of Cayenne stack, not only new DataContexts, but all the existing = ones will pick it up the moment you set it. Andrus On Jan 11, 2012, at 5:37 PM, Daniel Bruegge wrote: > Hi, >=20 > I am trying to change dynamically the database server and connection > in the application code. I am using the PoolManager and > DataSource-setting like described in > https://cwiki.apache.org/CAY/setting-database-connection.html. >=20 > What I was wondering: if I change this connection things with the > code above, will the next created DataContext using the new server? > I am creating the context via >=20 > DataContext.createDataContext(); >=20 > set to the new server? >=20 > Thanks & regards >=20 > Daniel >=20