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

Web and WebWorks Development

Reply
Retired
tneil
Posts: 3,708
Registered: ‎10-16-2008
My Device: Z10
My Carrier: Rogers

Re: BB Torch and sqlite/http connection

Can you specify which OS version of 6 you are experiencing the issue?

 

We have sample code in our Weather application that is working fine..

 

http://supportforums.blackberry.com/t5/Web-Development/Sample-Code-Weather-application/ta-p/589884

Tim Neil
Director, Application Platform & Tools Product Management
Follow me on Twitter
Contributor
mobabelsupport
Posts: 21
Registered: ‎11-24-2010
My Device: Not Specified

Re: BB Torch and sqlite/http connection

[ Edited ]

I have tested this weather widgets,

first time with sign, got "security_err: DOM Exception 18" when run

second time without sign, got "attempts to access a secure API"

I tested this on 9800 Torch, OS version v6.0.0.141  Bundle 278 Platform 6.4.0.64

and 9780, OS vv6.0.0.110, Bundle 231, Platform 6.5.0.13

 

Sorry, but i wonder have you really tested your DB widgets on OS 6.0?

Retired
tneil
Posts: 3,708
Registered: ‎10-16-2008
My Device: Z10
My Carrier: Rogers

Re: BB Torch and sqlite/http connection

I have the exact same OS version on my Torch 9800 and I have loaded a signed version of the Weather application and it works without any error. 

 

I'm trying to figure out why your device is different.  Do you have a media card inserted?  If you remove the media card does it make a difference?  I'm wondering if it could be like the original poster's formatting method used on the media card.

 

Do you have any corporate IT policies set on your device that may block storage?

Tim Neil
Director, Application Platform & Tools Product Management
Follow me on Twitter
Contributor
mobabelsupport
Posts: 21
Registered: ‎11-24-2010
My Device: Not Specified

Re: BB Torch and sqlite/http connection

Hi, thank you for your reply!!

Yes, my Torch have a 4GB media card, and USB disconntected. (9780 has also media card)

I have not yet tested remove the media card, but i have tested the widgets when i connected USB(media card in using), it throws the same exception.

 

What do you mean the format method? which format should i use? fat32 or fat?

 

Do you have any corporate IT policies set on your device that may block storage?

this question i am not sure, at least i can store files into the card.

 

This is very strange!!!

Retired
tneil
Posts: 3,708
Registered: ‎10-16-2008
My Device: Z10
My Carrier: Rogers

Re: BB Torch and sqlite/http connection

We have some people here trying to replicate your issue and see if there is any specific formatting that needs to be done on the media card.

 

One limitation to be aware of, is that if you have your device plugged in via USB and you chose to switch on "Mass Storage Mode" your SQLite databases will not work and you will likely see that security error.

Tim Neil
Director, Application Platform & Tools Product Management
Follow me on Twitter
Retired
tneil
Posts: 3,708
Registered: ‎10-16-2008
My Device: Z10
My Carrier: Rogers

Re: BB Torch and sqlite/http connection

Here are some other steps that you can try to see if it resolves the issue:

 

Use the following steps to remove the database on the internal MMC.

1)      Restart the device

2)      Start Media application then select “Explore” in the Menu

3)      Select “Show Hidden” in the Menu

4)      Navigate to  /Device/BlackBerry/system/appdata/rim

5)      Delete the webstorage folder if there

6)      Start the weather widget.

Tim Neil
Director, Application Platform & Tools Product Management
Follow me on Twitter
Contributor
mobabelsupport
Posts: 21
Registered: ‎11-24-2010
My Device: Not Specified

Re: BB Torch and sqlite/http connection

hi, Thank you for your answer, you are right, i think it is cache problem.

And i know now how to reproduce this problem.

1, install db app

2, usb connected

3, run db app, err 18 occurs.

4, usb disconnected, run app, there will be always err_18. whatever you update the app, or disconnected the usb, the error comes forever.

 

 

Solution:

1 deinstall db app totally, install db app again. Better restart device

2. MAKE SURE USB disconntected

3, run app, everything ok.

 

Developer
araskin
Posts: 128
Registered: ‎08-01-2008
My Device: Bold 9900, 9810, 9780, 9650 and so many others

Re: BB Torch and sqlite/http connection

Hi Everyone,

 

Tim's positing above resolved my issue so I wanted to share a bit more with this thread in case anyone else has the same issue.

 

My 'app' is actually just a HTML page with JS embedded in it (not Widget) which executes on the device. I was having some trouble with the DB so I decided to plug in the Torch and find the DB files which I then manually deleted. After that everytime I ran my page, i would get an INVALID_STATE_ERR DOM exception 11 when I called openDatabase. 

 

Anyway, I simply followed Tim's suggestion and manually deleted the localStorage folders using the built in explorer of the device. I then rebooted and everything seems to be OK now.

 

I do see that there is an issue here though: If the user plugs in their BB and sets it to Mass Storage Mode, and then attempts to use our app they will get an error. Is there a way to detect that the device is in Mass Storage so we can prompt the user to reboot, etc?

 

Regards,

 

Alon

Contributor
bryfox
Posts: 15
Registered: ‎11-01-2010
My Device: Not Specified

Re: BB Torch and sqlite/http connection

Presumably you've found the answer already, but for posterity, calling isMassStorageActive() does seem to work.

 

blackberry.system.isMassStorageActive()

 

One should probably never make a call to `openDatabase` if the above returns true.

 

Contributor
bryfox
Posts: 15
Registered: ‎11-01-2010
My Device: Not Specified

Re: BB Torch and sqlite/http connection

I've done some more testing with both my app and the Weather sample, and the problem appears to be much worse than I thought. The following steps will reproduce the INVALID_STATE_ERR on my Torch running 6.0.0.141 (mass storage mode active).

 

1. Install app from desktop manager

2. Disconnect phone from USB

3. Open app. (Runs as expected; can read/write db)

4. Quit app completely.

5. Hook phone back up to USB. Let Desktop Manager load list of apps (not sure if this is necessary) but don't touch anything on phone or Desktop Manager.

6. Disconnect phone from USB

7. Run app. When Attempting to open DB, "INVALID_STATE_ERR: DOM Exception 11" is thrown.

 

It seems that simply hooking my phone up to USB after the app has been installed will irrevocably corrupt its database. The only fix appears to involve uninstalling the app & rebooting the device.

 

At step 7 in my app, I catch & log the error. In the weather app, I assume the same thing is happening, because if I try to add or remove a location, nothing happens. If I "remove all", I get an error message. At this point, I can't even close the app from the menu. If I run the weather app the first time hooked up to USB, an alert displays "INVALID_STATE_ERR: DOM Exception 18"