Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 343660

Summary: missing INFORMIX connection remedy
Product: z_Archived Reporter: Vladimir <zivl>
Component: EclipselinkAssignee: Nobody - feel free to take it <nobody>
Status: NEW --- QA Contact:
Severity: normal    
Priority: P2 CC: andrewsleeman24, tom.ware
Version: unspecified   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard: informix

Description Vladimir CLA 2011-04-22 11:47:49 EDT
Build Identifier: 

When a connection to Informix database is broken Eclipselnik fails to recover:

<pre>
Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.1.0.v20100614-r7608): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: java.sql.SQLException: Connection not established
Error Code: -79730
Call: SELECT * FROM xx WHERE id=1
Query: ReadObjectQuery(referenceClass=SlovnikImpl sql="SELECT * FROM xx WHERE id=1")
	at org.eclipse.persistence.exceptions.DatabaseException.sqlException(DatabaseException.java:333)
	at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.basicExecuteCall(DatabaseAccessor.java:683)
    ...
</pre>

Eclipselink supports reconnection in such situation for databases such as Oracle, SqlServer or MySql but not for Informix. 

Eclipselink supports the feature by means of a ping SQL query. 
It is possible to add such support for Informix also by adding foloving lines into InformixPlatform.java (package org.eclipse.persistence.platform.database):
<code>
    public InformixPlatform() {
    	super();
    	super.pingSQL = "select 1 from sysusers";
    }
</code>


Tested versions : 
- Eclipselink: 2.1.0.v20100614-r7608 respective 2.2.0.v20110202-r8913;
- IBM Informix JDBC Driver for IBM Informix Dynamic Server:  3.00.JC3 respective 3.50.JC6W1.


Reproducible: Always

Steps to Reproduce:
1. Create session and connect it to database.
2. Close the connection by DB server means (or by session.getAccessor().getConnection().close()).
3. Execute a query against database
Comment 1 Tom Ware CLA 2011-05-12 15:38:39 EDT
Setting target and priority.  See the following page for the meanings of these fields:

http://wiki.eclipse.org/EclipseLink/Development/Bugs/Guidelines

Community: Please vote for this bug if it is important to you.  Votes are one of the main criteria we use to determine which bugs to fix next.
Comment 2 Andrew Sleeman CLA 2013-03-11 17:18:50 EDT
An alternate statement might be.

select count(*) from sysusers

Reason: It will always only result in 1 row.
Comment 3 Andrew Sleeman CLA 2013-03-11 18:33:20 EDT
I suspect this "bug" will never get any attention, is you want to work around it I did the following and I did wonders for my application following a network outage recovery. 

 1) created a new Database Platform Class.
package my.eclipselink;

public class InformixSEPlatform extends org.eclipse.persistence.platform.database.InformixPlatform {

	private static final long serialVersionUID = 1L;

	public InformixSEPlatform() {
		super();
		pingSQL = "SELECT COUNT(*) FROM SYSUSERS";
	}
}

 2) Added the persistence.xml property to use it.
  <property name="eclipselink.target-database" value="my.eclipselink.InformixSEPlatform"/> 

PS. Thank you designers for the flexible design of eclipselink.
Comment 4 Eclipse Webmaster CLA 2022-06-09 10:30:48 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink