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
Developer
vivart
Posts: 147
Registered: ‎08-27-2010
My Device: 9800
My Carrier: airtel

invalid path exception in DatabaseFactory.exists()

I am testing sqlite database code in blackberry simulator 5.0 and 6.0. I have created the sdcard for simulators. but sometimes I am getting inavlid path exception on DatabaseFactory.exists() method call.

 

   //URI myURI = URI.create("/Store/Databases/usage.db");
            //URI myURI = URI.create("file:///SDCard/databases/usage.db");
            URI myURI = URI.create("file:///SDCard/usage.db");
            //check if database exists or not

            if ( DatabaseFactory.exists(myURI) )
            {
                d = DatabaseFactory.open(myURI);
            }
            else
            {
                d = DatabaseFactory.openOrCreate(myURI);        

            }

 

 

I can see the file "usage.db" in SDCard folder and currently I don't have real device to test this code. am I missing something?

Please use plain text.
Developer
peter_strange
Posts: 19,595
Registered: ‎07-14-2008
My Device: Not Specified

Re: invalid path exception in DatabaseFactory.exists()

Can't see anything wrong with the code.

 

To check that you BB device can see this, find the Files app, or go into Media, then press the menu button and select Explore.  Make sure that the SImulator can actually see this on the BlackBerry. 

 

I've never noted any significant difference between the behavior of SQLite on Simulator and device, but I have really not used SQLite that much. 

Please use plain text.