PointBase使用方法(也许是J2ME程序员你急切想了解)
1.下载玩数据库以后还要记得从自己邮箱里下载lisecens
2.在dos模式下进入在你下载并解压的目录下执行 Java -classpath ./install.jar install
3.装上pointbase然后将lisecens考到安装目录下。(lisences千万不要改不然程序连接时会出错)
4.将PointBase的lib加入到你的工程中,如果你使用EclipseMe的话请安装以下步骤操作。
选择Project->properties菜单
5.如果工程重要使用PointBase那么还要将这些类引入到工程中来
6.好了尽情使用你的PonitBase吧
try {
Class.forName("com.pointbase.me.DriverManager");
Connection conn=DriverManager.getConnection(
"jdbc:pointbase:micro:test","PBPUBLIC","PBPUBLIC");
Statement stat=conn.createStatement();
DatabaseMetaData meta=conn.getMetaData();
ResultSet rs=meta.getTables(null,null,"TEST",null);
if(rs.next()) {
// the table already exists
stat.execute("UPDATE TEST SET ID=ID+1");
} else {
// the table doesn't exist yet
stat.execute("CREATE TABLE TEST(ID INT)");
stat.execute("INSERT INTO TEST VALUES(1)");
}
rs=stat.executeQuery("SELECT ID FROM TEST");
rs.next();
int count=rs.getInt(1);
System.out.println("Hello Database!");
System.out.println("This application was run "+count+" time(s)");
conn.close();
} catch(Exception e) {
e.printStackTrace();
}
1.下载玩数据库以后还要记得从自己邮箱里下载lisecens
2.在dos模式下进入在你下载并解压的目录下执行 Java -classpath ./install.jar install
3.装上pointbase然后将lisecens考到安装目录下。(lisences千万不要改不然程序连接时会出错)
4.将PointBase的lib加入到你的工程中,如果你使用EclipseMe的话请安装以下步骤操作。
选择Project->properties菜单
5.如果工程重要使用PointBase那么还要将这些类引入到工程中来
6.好了尽情使用你的PonitBase吧
try {
Class.forName("com.pointbase.me.DriverManager");
Connection conn=DriverManager.getConnection(
"jdbc:pointbase:micro:test","PBPUBLIC","PBPUBLIC");
Statement stat=conn.createStatement();
DatabaseMetaData meta=conn.getMetaData();
ResultSet rs=meta.getTables(null,null,"TEST",null);
if(rs.next()) {
// the table already exists
stat.execute("UPDATE TEST SET ID=ID+1");
} else {
// the table doesn't exist yet
stat.execute("CREATE TABLE TEST(ID INT)");
stat.execute("INSERT INTO TEST VALUES(1)");
}
rs=stat.executeQuery("SELECT ID FROM TEST");
rs.next();
int count=rs.getInt(1);
System.out.println("Hello Database!");
System.out.println("This application was run "+count+" time(s)");
conn.close();
} catch(Exception e) {
e.printStackTrace();
}