黑莓中的 SQLite 数据库创建错误

发布于 2024-12-18 03:34:23 字数 331 浏览 4 评论 0原文

我正在尝试使用 BlackBerry IDE 创建 SQLite DB。首先,我使用模拟器将 SD 卡安装到 PC 中的一个文件夹中。

URI myURI = URI.create("file:///SDCard/Databases/" + "Test.db");
d = DatabaseFactory.create(myURI);
d.close();

运行代码后我得到异常

路径不包含正确的根列表。有关详细信息,请参阅 FileSystemRegistry 类

有人知道问题是什么吗?

I am trying to create an SQLite DB using BlackBerry IDE. First I mount sdcard to a folder in my PC using simulator.

URI myURI = URI.create("file:///SDCard/Databases/" + "Test.db");
d = DatabaseFactory.create(myURI);
d.close();

After I run the code I get the exception

Path does not contains a proper root list. See FileSystemRegistry class for details

Anybody know what is the issue?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

久夏青 2024-12-25 03:34:23

您可以尝试以下代码而不进行任何更改吗

Database d;
public CreateDatabaseScreen()
{

   try
   {
       URI myURI = URI.create("file:///SDCard/Databases/my_database/" +"Test.db"); 
       d = DatabaseFactory.create(myURI);
       d.close();
       add(new RichTextField("DB created successfully"));
   }
   catch ( Exception e ) 
   {         
       System.out.println( e.getMessage() );
       e.printStackTrace();
       add(new RichTextField("Error: "+e.toString()));
   }
}

Can you try the below code without any changes please

Database d;
public CreateDatabaseScreen()
{

   try
   {
       URI myURI = URI.create("file:///SDCard/Databases/my_database/" +"Test.db"); 
       d = DatabaseFactory.create(myURI);
       d.close();
       add(new RichTextField("DB created successfully"));
   }
   catch ( Exception e ) 
   {         
       System.out.println( e.getMessage() );
       e.printStackTrace();
       add(new RichTextField("Error: "+e.toString()));
   }
}
浅语花开 2024-12-25 03:34:23

我怀疑您在测试应用程序时插入了 USB 电缆。如果是这种情况,只需断开连接并重试。在 BB 上,如果连接了 USB 电缆,则 SDCard 将不可用。

I suspect a USB cable is inserted while you are testing the app. If this is the case just disconnect and try again. On BB if USB cable is attached then SDCard becomes unavailable.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文