db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rhys Campbell" <rhys.campb...@da-systems.co.uk>
Subject RE: No current connection
Date Fri, 03 Mar 2006 13:58:00 GMT

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. 

i.e. ResultSet rs = 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.



-----Original Message-----
From: Michael Segel [mailto:msegel@segel.com] 
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
> pretty well until tonight.
> My app starts up a database, drops a few views and then recreates
> When another one of my Java classes moves on to do a small SELECT
> should yield a single result). The exception "No current connection"
> raised with the query obviously failing.
> I have checked the Derby.log but I am warned that the file is binary,
> 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
> make some sections of text legible but I couldn't see anything useful
> 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 
a parameter of your new class when you instantiate it?

2) Are you overwritting your connection in your new class, losing the 
connection for that instance of the class variable?

Again, just shooting from the hip.

View raw message