9

データをメモリに保存しようとしています

ここに私が今持っているものがあります

//sq lite driver
Class.forName("org.sqlite.JDBC");
//database path, if it's new data base it will be created in project folder
con = DriverManager.getConnection("jdbc:sqlite:mydb.db");

Statement stat = con.createStatement(); 

stat.executeUpdate("drop table if exists weights");

//creating table
stat.executeUpdate("create table weights(id integer,"
    + "firstName varchar(30)," + "age INT," + "sex varchar(15),"
    + "weight INT," + "height INT,"
    + "idealweight INT, primary key (id));");

このデータをメモリに保存するには、このステートメント[ ":memory:"] をどこに置く必要がありますか。データは削除するまで保存しておく必要があります。

ありがとう

4

1 に答える 1

16

試す:

con = DriverManager.getConnection("jdbc:sqlite::memory:");
于 2012-02-07T12:34:47.067 に答える