I'm not sure I understand the question. Is this related to Ice? When you open and close database connections is part of your server code, isn't it?
As for the code below, I don't understand why you have so many Ice objects. Also, what is "insertInDB()" doing? It doesn't have any arguments, so what does it insert?
Sorry, but I'm a bit confused by the design below

I suggest to read the various examples in the Ice documentation in detail.