QT + ODBC Connection Pooling
-
Hello!
I want to use a connection pooling in my application. I wrote a simple test:
@
QString connectionString = QString::fromLatin1(
"DRIVER={SQL Server Native Client 10.0};SERVER=%1;DATABASE=%2;")
.arg("DESIGNER\SQLEXPRESS")
.arg("testdb");QString opts = QLatin1String("SQL_ATTR_CONNECTION_POOLING=SQL_CP_ONE_PER_HENV"); QSqlDatabase db = QSqlDatabase::addDatabase(QLatin1String("QODBC3")); db.setDatabaseName(connectionString); db.setConnectOptions(opts); db.setUserName("root"); db.setPassword("1"); while (1) { db.open(); QThread::msleep(100); }
@
In Performance Monitor i do not observe any ODBC Connection Pooling activity. What's wrong?
-
Hi, a guess: to be sure you're on ODBC3 perhaps you'll need to set that option as well, like:
@
QString opts = QLatin1String("SQL_ATTR_CONNECTION_POOLING=SQL_CP_ONE_PER_HENV;SQL_ATTR_ODBC_VERSION=SQL_OV_ODBC3;");
@