You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-user@db.apache.org by Marl Atkins <ma...@softlinksys.com> on 2006/09/14 21:22:52 UTC

Connection problems

Hi:

I'm having problems connecting to the database sometimes.
I'm pretty sure it has to do with not successfully closing it.
If I reboot the problem seems to disappear.

I've got a line in there that should close it down (taken from Francios
Orsini's demo) in the stop proc of the Applet.
I'm hoping that  will help but I'd like to know a little more about the
rules of connection.

How many concurrent connections are allowed?
Is there anything I can do to further ensure that it closes when the applet
dies?

The code I'm using to close is:

public void stop()
    {
        DBaseConn.closeDBase();
    }

public void closeDBase()
    {       
        try 
        {
            DriverManager.getConnection("jdbc:derby:;shutdown=true");

        } 
        catch (Exception e) 
        {            
            //Shutdown was already completed
        } finally 
        {
            oCn = null;
            ds = null;
        }       
        System.gc();
    }


Marl K. Atkins
Microsoft Certified Professional
SoftLink Systems, Inc.
(407) 388-1886 


RE: Connection problems

Posted by Marl Atkins <ma...@softlinksys.com>.
Hi Francios:
 
It's been awhile since I got this error so I *thought* I had fixed it:
 
Failed to start database 'CTMCDBase', see the next exception for details.
 
There is no 'next exception' that I'm seeing.
This is an embedded database used by an applet.
It seems as though I can't open more than one connection to it.

  _____  

From: Francois Orsini [mailto:francois.orsini@gmail.com] 
Sent: Thursday, September 14, 2006 6:32 PM
To: Derby Discussion
Subject: Re: Connection problems


Hi Marl,

Could you please post the exception you're getting when attempting to
connect to the database. This would help to diagnose a bit more definitely.

You should be able to open concurrent derby connections - Are you running
Derby embedded or in a client-server topology? Am assuming it is embedded
and at the end it does not really matter in terms of concurrent connections
(by default)  to a particular Derby instance, whether it is running in
embedded or server mode.

It would be great if you could post more details about the actual exception
stack trace and error message - you should be able to get this from the Java
console, if you're running your application within a web browser type of
client app.

The applet methods stop() and destroy() should get called as an applet
terminates - at a minimum, destroy() should be called and this is where a
Derby instance or database could be shutdown. Note that database connections
can also be opened/closed during the applet's lifecycle start/stop methods
You can find more information about the applet's lifecycle and the
appropriate methods to call here:
http://java.sun.com/docs/books/tutorial/deployment/applet/appletMethods.html

Cheers,

--francois


On 9/14/06, Marl Atkins <ma...@softlinksys.com> wrote: 

Hi:

I'm having problems connecting to the database sometimes.
I'm pretty sure it has to do with not successfully closing it.
If I reboot the problem seems to disappear.

I've got a line in there that should close it down (taken from Francios 
Orsini's demo) in the stop proc of the Applet.
I'm hoping that  will help but I'd like to know a little more about the
rules of connection.

How many concurrent connections are allowed?
Is there anything I can do to further ensure that it closes when the applet 
dies?

The code I'm using to close is:

public void stop()
    {
        DBaseConn.closeDBase();
    }

public void closeDBase()
    {
        try
        {
            DriverManager.getConnection ("jdbc:derby:;shutdown=true");

        }
        catch (Exception e)
        {
            //Shutdown was already completed
        } finally
        {
            oCn = null;
            ds = null; 
        }
        System.gc();
    }


Marl K. Atkins
Microsoft Certified Professional
SoftLink Systems, Inc.
(407) 388-1886





Re: Connection problems

Posted by Francois Orsini <fr...@gmail.com>.
Hi Marl,

Could you please post the exception you're getting when attempting to
connect to the database. This would help to diagnose a bit more definitely.

You should be able to open concurrent derby connections - Are you running
Derby embedded or in a client-server topology? Am assuming it is embedded
and at the end it does not really matter in terms of concurrent connections
(by default)  to a particular Derby instance, whether it is running in
embedded or server mode.

It would be great if you could post more details about the actual exception
stack trace and error message - you should be able to get this from the Java
console, if you're running your application within a web browser type of
client app.

The applet methods stop() and destroy() should get called as an applet
terminates - at a minimum, destroy() should be called and this is where a
Derby instance or database could be shutdown. Note that database connections
can also be opened/closed during the applet's lifecycle start/stop methods
You can find more information about the applet's lifecycle and the
appropriate methods to call here:
http://java.sun.com/docs/books/tutorial/deployment/applet/appletMethods.html

Cheers,

--francois

On 9/14/06, Marl Atkins <ma...@softlinksys.com> wrote:
>
> Hi:
>
> I'm having problems connecting to the database sometimes.
> I'm pretty sure it has to do with not successfully closing it.
> If I reboot the problem seems to disappear.
>
> I've got a line in there that should close it down (taken from Francios
> Orsini's demo) in the stop proc of the Applet.
> I'm hoping that  will help but I'd like to know a little more about the
> rules of connection.
>
> How many concurrent connections are allowed?
> Is there anything I can do to further ensure that it closes when the
> applet
> dies?
>
> The code I'm using to close is:
>
> public void stop()
>     {
>         DBaseConn.closeDBase();
>     }
>
> public void closeDBase()
>     {
>         try
>         {
>             DriverManager.getConnection("jdbc:derby:;shutdown=true");
>
>         }
>         catch (Exception e)
>         {
>             //Shutdown was already completed
>         } finally
>         {
>             oCn = null;
>             ds = null;
>         }
>         System.gc();
>     }
>
>
> Marl K. Atkins
> Microsoft Certified Professional
> SoftLink Systems, Inc.
> (407) 388-1886
>
>