I am closing the connection.
It seems to fail after I return from a page that executes this.

private List filterRecords(String empno) {
    DataContext context = DataContext.getThreadDataContext();
Expression qualifier = ExpressionFactory.matchExp(Employees.EMEMP_NO_PROPERTY, empno);
    SelectQuery query = new SelectQuery(Employees.class);
    query.andQualifier(qualifier);
    List employees = context.performQuery(query);
    return employees;
   }

Thanks
Frank
----- Original Message ----- From: "Andrus Adamchik" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Tuesday, February 13, 2007 11:21 AM
Subject: Re: getting bad connection


Frank,

after a number of calls, it fails.

it would help if you provide the details of your problems, like Exception stack traces.

My guess will be that you are not closing the connections\. You must call Connection.close() every time after you finish working with a connection.

Andrus


On Feb 13, 2007, at 11:14 AM, Frank wrote:
Hello,

I have this in a class to return a Cayenne connection.
It works ok at first, but after a number of calls, it fails.

public class DBConnections {....
public Connection getAS400Connection() {
try {
    Configuration config = Configuration.getSharedConfiguration();
    DataDomain domain = config.getDomain();
    DataNode node = domain.getNode("cdsurveyDomainNode1");
    return node.getDataSource().getConnection();
 } catch (Exception ex) {
  return null;
 }
}

Thanks

Frank




Reply via email to