View Single Post
  #1 (permalink)  
Old 09-03-2003
Mr.Freeze Mr.Freeze is offline
Registered User
 
 
Join Date: Aug 2003
Location: Germany
Posts: 23
create proxy and database

Hello,

In the following code snippet I create proxies to insert data in a database. The call TestPrx::checkedCast(base) invokes the constructor, that initializes my database-object with the primary key.

for(int i = 1; i <= 100; i++)
{
QString primaryKey = QString("name%1").stripWhiteSpace().arg(i);

Ice::ObjectPrx base = ic->stringToProxy((string) primaryKey + ":default -p 10000");
TestPrx proxy = TestPrx::checkedCast(base);
...
proxy->connectToDB(user, pwd, db);
//call set functions
...

proxy->insertInDB();

proxy->disconnectFromDB();
}

At the moment for every single object a database connection is opened, the object is inserted in the db and the connection is closed. Is there any possibility to open the database connection at the beginning and insert all the data within this connection?

Thank you for your hint.
Reply With Quote