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
Contributor
Posts: 17
Registered: ‎06-15-2011
My Device: Torch
My Carrier: Telus

Database Exception: "Invalid path name."

"Invalid path name.  Path does not contains a proper root list.  See FileSystemRegistry class for details."

 

URI uri = URI.create("file:///store/Databases/database2.db");

 

Tried this, which worked on the simulator, but not on the device.

 

Also tried this:
URI uri = URI.create("file:///SDCard/Databases/database2.db");

 

What might I be doing wrong? Smiley Sad

Contributor
Posts: 17
Registered: ‎06-15-2011
My Device: Torch
My Carrier: Telus

Re: Database Exception: "Invalid path name."

Code:
(Note: I have tried openOrCreate as well as create.  I have tried file:///store as well as file:///SDCard)

 

public static String createDatabase()

{

    try

    {

        URI strURI = URI.create("file:///store/Databases/database2.db");

        Database d = DatabaseFactory.openOrCreate(strURI);

        d.close();

    }

    catch( Exception e )

    {

        return(e.getMessage());

    }

    return("Okay!");

}

Contributor
Posts: 17
Registered: ‎06-15-2011
My Device: Torch
My Carrier: Telus

Re: Database Exception: "Invalid path name."

I've solved my issue in two cases, however it comes back here and there.

I haven't nailed down the trigger, but I'm under the moderate impression that you cannot make use of the SDCard while the phone is connected to your computer.

 

It seems the connection ties up the SDCard, making it unusable to applications.

 

Install application.

Disconnect device.

Run application.

 

Not 100% sure yet, but this seems to be the solution.

Developer
Posts: 202
Registered: ‎04-19-2011
My Device: Blackberry Bold 9780
My Carrier: TAM

Re: Database Exception: "Invalid path name."

This is just my opinion

1. SQLite can only work using SDCard...

2. If u plug in your blackberry into PC, SD card will be disabled during this plug in.. It's because Blackberry have been read by PC.. So, if you want to use SQLite, try at SD Card and start your application when it's not plugged in PC

 

Correct me if i'm wrong ^^

 

Developer
Posts: 202
Registered: ‎04-19-2011
My Device: Blackberry Bold 9780
My Carrier: TAM

Re: Database Exception: "Invalid path name."

This is just my opinion

1. SQLite can only work using SDCard...

2. If u plug in your blackberry into PC, SD card will be disabled during this plug in.. It's because Blackberry have been read by PC.. So, if you want to use SQLite, try at SD Card and start your application when it's not plugged in PC


Correct me if i'm wrong ^^


Contributor
Posts: 28
Registered: ‎06-21-2011
My Device: Torch 9800
My Carrier: Vodafone Egypt

Re: Database Exception: "Invalid path name."

Well this sure will stall my progress, coz i'm testing using a sim, no device for me to test on Smiley Sad

I hope this doesn't turn out to be the real cause.
Contributor
Posts: 10
Registered: ‎12-12-2011
My Device: Developer- 9800, 9780, 9300, 9700, 9105, 9900, 9360
My Carrier: Wind

Re: Database Exception: "Invalid path name."

Hi,

Hope that in the meanwhile you've found a solution for your problem. Either way I'll answer some of the things I know:

 

First of all, you are right!  In order to be able to use Sqlite DB on BB you'll need an SDCard. only some few models can store DB's on internal memory, so if you want to be sure your app works in all of them, you should think of using the SDCard.

 

It is possible to try out  how SQlite works while you have the device plugged to the pc, when you plug it in, just choose the 'charge only' option, that way it will not be recognized for file transfers and the SDCard will not be blocked for use (it has worked for me so far)

 

Hope this helps!

Contributor
Posts: 21
Registered: ‎01-17-2012
My Device: BlackBerry 9550
My Carrier: ???

Re: Database Exception: "Invalid path name."

You could try without specifying a path or check if a SDcard is available.
Contributor
Posts: 38
Registered: ‎03-13-2012
My Device: 9860
My Carrier: 1234

Re: Database Exception: "Invalid path name."

As people suggest, having your phone plugged in causes problems accessing the SD Card as your PC is using it. Charge only mode does not always work. As in some cases it is attaching anyway. So you manually eject the Blackberry drives via My computer.

 

Even then sometimes it fails, so disconnecting is the only way.

 

p.s. I use 9860 Torch.