【问题标题】:sqlite:How to use in memorysqlite:如何在内存中使用
【发布时间】:2012-02-08 12:45:29
【问题描述】:

我正在尝试将我的数据存储在内存中

这是我现在拥有的

//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:”]放在哪里来将我的这个数据存储在内存中,并且数据应该一直保存到我删除它为止。

谢谢

【问题讨论】:

    标签: sqlite in-memory-database


    【解决方案1】:

    试试:

    con = DriverManager.getConnection("jdbc:sqlite::memory:");
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-07-24
      • 2021-06-09
      • 2010-09-21
      • 1970-01-01
      • 1970-01-01
      • 2019-01-27
      • 1970-01-01
      • 2011-07-25
      相关资源
      最近更新 更多