sqlite: Cómo usar en memoria
-
27-10-2019 - |
Pregunta
Estoy intentando almacenar mis datos en la memoria
esto es lo que tengo ahora
//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));");
Ahora, ¿dónde debo poner esta declaración [": memoria:"] para almacenar mis datos en la memoria y los datos deben mantenerse guardados hasta que los elimine?
Gracias
Solución
Prueba:
con = DriverManager.getConnection("jdbc:sqlite::memory:");
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow