Pergunta

Estou tentando armazenar meus dados na memória

aqui está o que eu tenho agora

        //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));");

Agora, onde devo colocar esta declaração [": memory:"] para armazenar meus dados na memória e os dados devem ser mantidos salvos até que eu os exclua.

Obrigado

Foi útil?

Solução

Experimente:

con = DriverManager.getConnection("jdbc:sqlite::memory:");
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top