Jdbc H2显示DB_关闭延迟值(由set DB_关闭延迟设置)

Jdbc H2显示DB_关闭延迟值(由set DB_关闭延迟设置),jdbc,h2,in-memory-database,h2db,Jdbc,H2,In Memory Database,H2db,H2数据库有一系列以SET开头的命令,特别是SET DB_CLOSE_DELAY。我想知道DB_CLOSE_DELAY的值是多少。我正在使用JDBC。设置很容易 cx.createStatement.execute("SET DB_CLOSE_DELAY 0") 但以下各项均不返回DB_CLOSE_DELAY的实际值: cx.createStatement.executeQuery("DB_CLOSE_DELAY") cx.createStatement

H2数据库有一系列以SET开头的命令,特别是SET DB_CLOSE_DELAY。我想知道DB_CLOSE_DELAY的值是多少。我正在使用JDBC。设置很容易

cx.createStatement.execute("SET DB_CLOSE_DELAY 0")
但以下各项均不返回DB_CLOSE_DELAY的实际值:

cx.createStatement.executeQuery("DB_CLOSE_DELAY")
cx.createStatement.executeQuery("VALUES(@DB_CLOSE_DELAY)")
cx.createStatement.executeQuery("GET DB_CLOSE_DELAY")
cx.createStatement.executeQuery("SHOW DB_CLOSE_DELAY")

非常感谢您的帮助。

您可以在
信息\u架构中访问此设置和其他设置。设置
表-例如:

String url = "jdbc:h2:mem:;DB_CLOSE_DELAY=3";
Connection conn = DriverManager.getConnection(url, "sa", "the password goes here");
Statement stmt = conn.createStatement();
        
ResultSet rs = stmt.executeQuery("SELECT * FROM INFORMATION_SCHEMA.SETTINGS where name = 'DB_CLOSE_DELAY'");
while (rs.next()) {
    System.out.println(rs.getString("name"));
    System.out.println(rs.getString("value"));
}
在这个测试中,我使用了一个未命名的内存数据库,当我创建数据库时,我显式地将延迟设置为
3

打印语句的输出为:

DB_CLOSE_DELAY
3

您可以在
信息\u架构中访问此设置和其他设置。设置
表-例如:

String url = "jdbc:h2:mem:;DB_CLOSE_DELAY=3";
Connection conn = DriverManager.getConnection(url, "sa", "the password goes here");
Statement stmt = conn.createStatement();
        
ResultSet rs = stmt.executeQuery("SELECT * FROM INFORMATION_SCHEMA.SETTINGS where name = 'DB_CLOSE_DELAY'");
while (rs.next()) {
    System.out.println(rs.getString("name"));
    System.out.println(rs.getString("value"));
}
在这个测试中,我使用了一个未命名的内存数据库,当我创建数据库时,我显式地将延迟设置为
3

打印语句的输出为:

DB_CLOSE_DELAY
3