Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » [teneo]recover bad connections([teneo]recover bad connections)
[teneo]recover bad connections [message #1255675] Mon, 24 February 2014 13:01 Go to next message
RJ Mising name is currently offline RJ Mising name
Messages: 42
Registered: July 2009
Member
How do you recover from bad connections?
HbHelper hbHelper = HbHelper.INSTANCE;
HbDataStore hbDataStore = hbHelper.getDataStore(connName);
SessionFactory sessFac = hbDataStore.getSessionFactory();

Now if someone accidently restarts the database server while the app is still running.

I get this error
java.sql.SQLRecoverableException: No more data to read from socket

Is there a way to check the health of the HbDataStore and if it is not valid call
HbDataStore hbds = (HbDataStore)hbHelper.createRegisterDataStore(connName) again.
Re: [teneo]recover bad connections [message #1255768 is a reply to message #1255675] Mon, 24 February 2014 15:09 Go to previous message
Martin Taal is currently offline Martin Taal
Messages: 5326
Registered: July 2009
Senior Member
Hi RJ,
I don't think you need to create a new datastore. But not sure how you want to recover from a database restart while the
app is running. At least the current used connections will fail. New connections will again login to the restarted db
server.

You can also use connection pooling, many connection pools do check connections for validity before giving the
connection to the app.

gr. Martin

On 02/24/2014 07:01 PM, RJ Mising name wrote:
> How do you recover from bad connections?
> HbHelper hbHelper = HbHelper.INSTANCE;
> HbDataStore hbDataStore = hbHelper.getDataStore(connName);
> SessionFactory sessFac = hbDataStore.getSessionFactory();
>
> Now if someone accidently restarts the database server while the app is still running.
>
> I get this error
> java.sql.SQLRecoverableException: No more data to read from socket
>
> Is there a way to check the health of the HbDataStore and if it is not valid call
> HbDataStore hbds = (HbDataStore)hbHelper.createRegisterDataStore(connName) again.


--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Cell: +31 (0)6 288 48 943
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@xxxxxxxx - mtaal@xxxxxxxx
Web: www.springsite.com - www.elver.org
Previous Topic:Issue with the definition of gmf.nodes
Next Topic:[EMFStore][EMFClient] Using the EMFStore for simple storage
Goto Forum:
  


Current Time: Wed Jul 23 01:45:56 EDT 2014

Powered by FUDForum. Page generated in 0.01471 seconds