Connections & Pooling

From: noban (noba..andex.ru)
Date: Wed Nov 30 2005 - 09:57:27 EST

  • Next message: Andrus Adamchik: "Re: Connections & Pooling"

    Hi!

    I`m recieving strange error.

    After 10 successfull inserts into DB my program recieves error, that I`ve reached max connections count, as you can imagine my max connections count param is set to 10.
    So my gues is that I`m just wrongly using Cayenne for desktop client.

    I`m using it in such a way:

    ...
    DataContext dataContext = MyConnectionModel.getDataContext();
    MyTableClass tableClassObj = (MyTableClass)dataContext.createAndRegisterNewObject(MyTableClass.class);
    tableClassObj .setColumn1Value(value);
    tableClassObj .setColumn2Value(value);
    ...
    try {
            dataContext.commitChanges();
    } catch (Exception e) {
            e.printStackTrace();
    }

    Is this right way to do things?

    I mean taht, my program opens all 10 connections, and thats, all.
    What I should do to prevent from opening new connections, and
    how to use opened one`s, or at least close them after: ctxt.commitChanges()?

    And actually how I can check my hypothesis (that program is opening new connections and holding old one`s)?



    This archive was generated by hypermail 2.0.0 : Wed Nov 30 2005 - 09:57:37 EST