From derby-user-return-3704-apmail-db-derby-user-archive=db.apache.org@db.apache.org Fri Mar 03 13:56:41 2006 Return-Path: Delivered-To: apmail-db-derby-user-archive@www.apache.org Received: (qmail 55617 invoked from network); 3 Mar 2006 13:56:38 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 3 Mar 2006 13:56:34 -0000 Received: (qmail 19819 invoked by uid 500); 3 Mar 2006 13:57:18 -0000 Delivered-To: apmail-db-derby-user-archive@db.apache.org Received: (qmail 19793 invoked by uid 500); 3 Mar 2006 13:57:18 -0000 Mailing-List: contact derby-user-help@db.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: List-Id: Reply-To: "Derby Discussion" Delivered-To: mailing list derby-user@db.apache.org Received: (qmail 19782 invoked by uid 99); 3 Mar 2006 13:57:17 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 03 Mar 2006 05:57:17 -0800 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: local policy) Received: from [213.208.108.44] (HELO das01.DAS.local) (213.208.108.44) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 03 Mar 2006 05:57:17 -0800 Content-class: urn:content-classes:message Subject: RE: No current connection MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Date: Fri, 3 Mar 2006 13:58:00 -0000 X-MimeOLE: Produced By Microsoft Exchange V6.5.7226.0 Message-ID: <79CBD9C7DAEEF7499CBD13C913D251C603E401@das01.DAS.local> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: No current connection Thread-Index: AcY+x0b1bYjBb+nlQnaiGsUPllLvUAAAeJlQ From: "Rhys Campbell" To: Cc: X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Hi, I have a method called initDatabase() which returns the Connection variable. When I execute any query against the database I call another method of which the first parameter is the Connection (i.e. I place initDatabase() as the parameter.=20 i.e. ResultSet rs =3D database.executeQuery(initDatabase(), "SELECT * = FROM myTable"); (Code from memory!) Connections are not passed between the main (business logic) classes. They all have access to a little class called DBTools which I wrote to simplify DB access. I have a play with your ideas this evening and maybe post my code. Thanks for your thoughts. Regards, Rhys -----Original Message----- From: Michael Segel [mailto:msegel@segel.com]=20 Sent: 03 March 2006 13:36 To: Rhys Campbell Subject: Re: No current connection On Thursday 02 March 2006 7:20 pm, you wrote: > Hi, > > I'm using Derby for a current project for the first time. Got on with it > pretty well until tonight. > > My app starts up a database, drops a few views and then recreates them. > When another one of my Java classes moves on to do a small SELECT (that > should yield a single result). The exception "No current connection" is > raised with the query obviously failing. > > I have checked the Derby.log but I am warned that the file is binary, when > it opens in my editor, and a load of "junk" is displayed. I did use a > little tool called "fd" which is a oct / hex character editor. This did > make some sections of text legible but I couldn't see anything useful to > explain my issue. > > Can anyone offer me any pointers? > > Many thanks, > > Rhys Just to update the post I made... Since you mention multiple classes... 1) Check the scope of the connection declaration and are you passing it in as=20 a parameter of your new class when you instantiate it? 2) Are you overwritting your connection in your new class, losing the=20 connection for that instance of the class variable? Again, just shooting from the hip.