aspose file tools
The moose likes OO, Patterns, UML and Refactoring and the fly likes Program just shuts down. No error, nothing! Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Engineering » OO, Patterns, UML and Refactoring
Reply Bookmark "Program just shuts down. No error, nothing!" Watch "Program just shuts down. No error, nothing!" New topic
Author

Program just shuts down. No error, nothing!

David Shepherd
Ranch Hand

Joined: Mar 02, 2001
Posts: 35
I can't figure this one out.
I have a singleton that creates a DB connection to an access database. The singleton is used in an Observer pattern and is the observable of a JTableModel based class.
I also have a dialog box that calls a static method of the singleton and adds some values to the database.
It seems to work. However, sometimes (I see no pattern to it) when I update the database the application just stops running. No stack trace, no error, nothing. I think I have it narrowed down to the methods that make DB connections. I make and close a connection to fill the table in the beginning and every time there is an update call. I'm thinking this may have something to do with it.
Any ideas would be greatly appreciated.
Mikael Jonasson
Ranch Hand

Joined: May 16, 2001
Posts: 158
Could it be that you get some looks in the database, so your applications i waiting for a respons that never gets there?
Or could it be that you aren't handeling all exceptions "in the right place", so that an exception raised in the connection is thrown all the way to the "end" of your application?
Just some thoughts
/Mike
David Shepherd
Ranch Hand

Joined: Mar 02, 2001
Posts: 35
Could be. I'm handling exceptions but maybe not in the right places.
Thanks for the ideas. Now I have somewhere to begin at least.
Desai Sandeep
Ranch Hand

Joined: Apr 02, 2001
Posts: 1157
Might be lots of updates are taking place simultaneously.If that is a case, I would suggest, you have a pool of connections, which updates the records in the DB.So when you actually close the connection, you are not destroying it but putting it back to the pool.This way you may probably save time and resource creating and destroying the connections with the DB.
Also, make sure, that wherever you are handling exceptions, you give proper System.err statement or a call to events' printStackTrace() method, to capture the exception, if any.
Hope this helps,
Sandeep



<b>Sandeep</b> <br /> <br /><b>Sun Certified Programmer for Java 2 Platform</b><br /> <br /><b>Oracle Certified Solution Developer - JDeveloper</b><br /><b>-- Oracle JDeveloper Rel. 3.0 - Develop Database Applications with Java </b><br /><b>-- Object-Oriented Analysis and Design with UML</b><br /> <br /><b>Oracle Certified Enterprise Developer - Oracle Internet Platform</b><br /><b>-- Enterprise Connectivity with J2EE </b><br /><b>-- Enterprise Development on the Oracle Internet Platform </b>
David Shepherd
Ranch Hand

Joined: Mar 02, 2001
Posts: 35
Excellent ideas. Would anyone have a link to information on creating a connection pool, etc...
Desai Sandeep
Ranch Hand

Joined: Apr 02, 2001
Posts: 1157
Originally posted by David Shepherd:
Excellent ideas. Would anyone have a link to information on creating a connection pool, etc...

Please refer to Developing Java Servlets,James Goodwill,Page 173 for an example on Connection Pooling.Although the example is with Servlets, I believe, by going through it you can easily implement for Swing client also.
Hope this helps,
Sandeep
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Program just shuts down. No error, nothing!
 
Similar Threads
Program just shuts down. No error, nothing!
Java Database connection
Why close the connection, statement and resultset?
j2ee without ejb
Why is Singleton needed for thread safety