【发布时间】:2023-02-22 21:32:28
【问题描述】:
一开始连接正常,但在使用应用程序一段时间后(比如一个小时),它停止了,我得到了错误: “org.h2.jdbc.JdbcSQLNonTransientConnectionException:数据库可能已在使用中:“C:/Users/Setup Game/eclipse-workspace/eclipse java D/Gestion/test/Database/les.mv.db”。可能的解决方案:关闭所有其他连接;使用服务器模式 [90020-214] java.lang.NullPointerException:无法调用“java.sql.Connection.prepareStatement(String)”,因为“this.connectore.connection”为空 它随机停止并返回 null 尽管非按钮代码导致它崩溃,一开始一切正常 这是我的代码:
Class.forName("org.h2.Driver");
connection = DriverManager.getConnection("jdbc:h2:"+"./test/Database/les","root","");
stmStatement = connection.createStatement();
String sql = "create table IF NOT EXISTS info("
+ "n_dossier varchar(20) not null primary key,"
+ " nom varchar(100) not null";
stmStatement.executeUpdate(sql);
connection.prepareStatement("BACKUP TO './test/backup.zip'").executeUpdate();
如果我删除数据文件并休息它再次工作正常
【问题讨论】: