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
相关文档:
我老婆工作要管理好多的excel表格比较的麻烦,于是想着帮忙写个软件让她方便点
其实我winform软件还没有写过呢,以前写的都是web的
因为写的软件就是她自己用用我想应该不需要用什么大的数据库的,所以我最先想到用access数据库挺方便的文件复制就可以了
可是我没有office access啊,不过我记得电脑上好像有access数据库 ......
安装:
官方网站下载最新的sqlite版本
官方网站: http://www.sqlite.org/
下载地址为: http://www.sqlite.org/download.html
官方的下载页面提供了很多版本的下载…这里介绍一下;
Source Code: 源代码版本的下载
Documentation: 相关文档
Precompiled Binaries for Linux / Precompiled Binaries For Mac ......
本文以数据库中的数据表UserInfo为实例展示数据库表的创建及数据记录的录入。
#!/bin/sh
#variables definition
#database location
db=/conf/db
#
#create table userInfo
#name: User name
#passwd: Password
#Privilege: User privilege -- Administrator:0 Operator:1
#
echo "create table UserInfo(n ......
package
{
import flash.data.SQLConnection;
import flash.data.SQLResult;
import flash.data.SQLStatement;
import flash.errors.SQLError;
import flash.events.SQLErrorEvent;
import flash.events.SQLEvent;
import flash.filesystem.File;
import mx.collections.Ar ......