SQLite on BlackBerry 完美支持中文

sqlite on BlackBerry上,JDBC访问数据库,缺省是以UTF-8保存数据到数据库里面的,每个中文通常是3个字节保存到数据库上面的。

例子代码参考:

BlackBerry sample - sqliteDemo。

注意:在插入中文的时候,请使用Statement.bind指令,在我的测试中,可以很好的保存中文数据。读取的时候只需要使用ResultSet.getString()就可以了。

而直接使用拼接好的sql insert语句插入数据,可能会有插入中文乱码问题。

Statement statement = _db.createStatement("INSERT INTO Category VALUES(null,?)");
statement.prepare();
statement.bind(1,name);
statement.execute();
statement.close();


参考:
1)sqlite
http://www.sqlite.org/download.html

2)sqlite Expert Personal is freeware and does not have an expiration date.(可以识别UTF-8编码的中文数据)

使用sqlite Expert Personal可以打开BlackBerry手机SD卡上的sqlite数据库,并且正常显示UTF-8编码的中文数据。This is just perfect for trouble shooting中文数据库


http://www.sqliteexpert.com/download.html

3)sqlite admin(不能识别UTF-8编码的中文数据)
http://sqliteadmin.orbmu2k.de/

4)JDBC Driver for Windows(在eclipse 的perspective "Database Development" 中,使用sql Scrapbook执行sql语句可以正确创建表/插入/查看 中文数据)
http://www.zentus.com/sqlitejdbc/
http://www.xerial.org/trac/Xerial/wiki/SQLiteJDBC

相关文章

SQLite架构简单,又有Json计算能力,有时会承担Json文件/RES...
使用Python操作内置数据库SQLite以及MySQL数据库。
破解微信数据库密码,用python导出微信聊天记录
(Unity)SQLite 是一个软件库,实现了自给自足的、无服务器...
安卓开发,利用SQLite实现登陆注册功能