[Interest] [Help]A big problem about accessing database using OCI driver plugin from qt application.‏

Xiaognag Wang xiaogangwang2012 at hotmail.com
Tue Oct 30 09:13:18 CET 2012


I used sql driver plugin at "C:\QtSDK\Desktop\Qt\4.8.1\mingw\plugins\sqldrivers",  tested with "OCI+Oracle" and "ODBC+Oracle", the performance are so different(7s and 30ms for geting 20000 record).
Oracle database server is at different host in Local Area Network.
if I use query.next(), it will retured 256 records at once.
I added code segment at following, //======================================================// create connection//======================================================
db = new QSqlDatabase(QSqlDatabase::addDatabase("QOCI",conname));db->setHostName(HostName);db->setDatabaseName(DatabaseName);db->setUserName(UserName);db->setPassword(Password);db->setPort(Port);  


//=====================================================// 2. get 20000 record from remote Oracle database->// use ODBC driver plugin : need 7      seconds// use OCI    driver plugin : need 0.03 seconds// =====================================================void function(){	QSqlQueryModel plandatamodel;	FlyPlanData fpltemp;	plandatamodel.setQuery("SELECT * FROM FPL WHERE to_char(DOF,'YYYY-MM-DD')=to_char(sysdate,'YYYY-MM-DD')",*db);      	while(plandatamodel.canFetchMore())	{		plandatamodel.fetchMore();	}
	for(int i=0;i<plandatamodel.rowCount();i++)	{		fpltemp.id=plandatamodel.record(i).value("ID").toInt();                .......		fpltemp.xfl=plandatamodel.record(i).value("XFL").toInt();	  		flyplandata.append(fpltemp);	}}
I really don't understand why the speed is so slow, Could you please give a suggestion? thanks.
BR,Eric2012.10.30

From: scott.bloom at onshorecs.com
To: interest at qt-project.org
Date: Mon, 29 Oct 2012 10:56:15 +0000
Subject: Re: [Interest] [Help]A big problem about accessing database using OCI driver plugin from qt application.‏


Which ODBC driver are you using? (Qt or native C++ driver?) Most likely, you are using the Qt for the Oracle and native C++ for the odbc…  Qt’s system if used improperly can add quite a bit of overhead. First, how often are you creating your QSqlQuery’s? Next, QVariant, while as fast as most variant system, can still be slower than raw “union based” casts that many native C++ interfaces provide..  However, make sure your calls to the SQL engine are using the correct types and NOT relying on the qvariant conversions.. ie, don’t send back a string to convert to an integer.. Without seeing code, its gonna be hard to diagnose further.
Scott From: interest-bounces+scott=onshorecs.com at qt-project.org [mailto:interest-bounces+scott=onshorecs.com at qt-project.org] On Behalf Of Xiaognag Wang
Sent: Monday, October 29, 2012 10:23 AM
To: qt-interest
Subject: [Interest] [Help]A big problem about accessing database using OCI driver plugin from qt application.‏ Dear All, I meet a big problem need your help:1. my evnriomnent: Win7 + Qt-SDK1.2.1 + oracle11g_home22. I compiled oci driver plugin for accessing Oracle database from qt applicatio n.3. the problem is: it is too slow to get data from database, for example:  get 20000 records from database will spend 7 seconds, if I use odbc instead, it will just need about 30 ms. Does anyone have experience about this? Could you please give a suggestion for me? Best Regards!Eric2012.10.29
_______________________________________________
Interest mailing list
Interest at qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20121030/78a4338f/attachment.html>


More information about the Interest mailing list