无法从 BlackBerry 中的 SQLite 数据库获取值
我试图从 SQlite 数据库获取表值,但无法在 DatabaseFactory.open() 处打开 URI。
我写了下面的代码:
URI myURI = null;
Cursor cursor = null;
try
{
myURI = URI.create("/SDCard/databases/itemdb.db");
try
{
if(DatabaseFactory.exists(myURI))
{
Database sqliteDb = DatabaseFactory.open(myURI);
try
{
Statement st=sqliteDb.createStatement(query);
st.prepare();
Logger.out("Grocery", "it is comin here ---- 12");
cursor = st.getCursor();
}
}
}
}
I am trying to get the table values from the SQlite database, but it is unable to open the URI at DatabaseFactory.open().
I wrote the below code:
URI myURI = null;
Cursor cursor = null;
try
{
myURI = URI.create("/SDCard/databases/itemdb.db");
try
{
if(DatabaseFactory.exists(myURI))
{
Database sqliteDb = DatabaseFactory.open(myURI);
try
{
Statement st=sqliteDb.createStatement(query);
st.prepare();
Logger.out("Grocery", "it is comin here ---- 12");
cursor = st.getCursor();
}
}
}
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果包含 open() 调用失败时收到的错误消息,那就更好了。
基于此评论:
我猜您已经从插入中打开了数据库。确保插入代码正确关闭数据库,并且已同步,以便读取不会尝试与插入代码同时运行。
It would be better if you included the error message you get when the open() call fails.
Based on this comment:
I am guessing you already have the database open from the insertions. Make sure the insertion code is properly closing the database, and that you have synchronization so that the read does not try to run at the same time as the insertion code.