Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Highlighted
Contributor
Posts: 22
Registered: ‎05-14-2012
My Device: bold 9700
My Carrier: vodafone

Sqlite Insert Faster

[ Edited ]

Hi,

synchronized (UiApplication.getEventLock()){
for (int count=1;count<675;count++){

yuzde= count/22*100;
HttpConnection fconn=(HttpConnection)Connector.open("http://w.xxx.com/file/t2e"+String.valueOf(count)+".txt;interface=wifi");
anaekr.yuzdedegistir("%"+String.valueOf(yuzde));
int status = fconn.getResponseCode();

if (status == HttpConnection.HTTP_OK) {
InputStream httpInput=fconn.openInputStream();
String result = new String(IOUtilities.streamToBytes(httpInput),"UTF-8");
System.gc();
d1.beginTransaction();
while(result.indexOf("@")!=-1)
{
int end= result.indexOf("@");
String query=result.substring(0,end);
result=result.substring(end+1);
st = d1.createStatement(query);
System.out.println(query);
st.prepare();
st.execute();
st.close();
}
d1.commitTransaction();
}
}

}

 

I should insert 100k rows data in sqlite.I  But it takes 50 minute. Is it normal ?

Developer
Posts: 141
Registered: ‎07-13-2011
My Device: BB Bold
My Carrier: Vodafone

Re: Sqlite Insert Faster

Hi 

 

I am not totally agree with you regarding storing such a large amount of data in sqlite.

 

Its a light database....

 

What i would do is store the data in server and access it whenever needed.

 

Second thing u r doing is getting the sql file from web, which is again not good in my opinion.

 

You can create a data file with all your data and create the sqls programatically which will definitely run faster.

 

 

Cheers

Rabi Ray

Contributor
Posts: 22
Registered: ‎05-14-2012
My Device: bold 9700
My Carrier: vodafone

Re: Sqlite Insert Faster

Thank you rabi.

 

Database size around 10 MB. I think it is not too large for Sqlite . isn't it? 

But may be number of records(~100k rows) too many for sqlite. I don't know.