org.h2.server.web.WebServer.getConnection()方法的使用及代码示例

x33g5p2x  于2022-02-03 转载在 其他  
字(4.4k)|赞(0)|评价(0)|浏览(83)

本文整理了Java中org.h2.server.web.WebServer.getConnection()方法的一些代码示例,展示了WebServer.getConnection()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WebServer.getConnection()方法的具体详情如下:
包路径:org.h2.server.web.WebServer
类名称:WebServer
方法名:getConnection

WebServer.getConnection介绍

[英]Open a database connection.
[中]打开数据库连接。

代码示例

代码示例来源:origin: com.h2database/h2

private String login() {
  String driver = attributes.getProperty("driver", "");
  String url = attributes.getProperty("url", "");
  String user = attributes.getProperty("user", "");
  String password = attributes.getProperty("password", "");
  session.put("autoCommit", "checked");
  session.put("autoComplete", "1");
  session.put("maxrows", "1000");
  boolean isH2 = url.startsWith("jdbc:h2:");
  try {
    Connection conn = server.getConnection(driver, url, user, password);
    session.setConnection(conn);
    session.put("url", url);
    session.put("user", user);
    session.remove("error");
    settingSave();
    return "frame.jsp";
  } catch (Exception e) {
    session.put("error", getLoginError(e, isH2));
    return "login.jsp";
  }
}

代码示例来源:origin: com.h2database/h2

Connection conn;
try {
  conn = server.getConnection(driver, url, user, password);
} finally {
  prof.stopCollecting();

代码示例来源:origin: com.h2database/com.springsource.org.h2

private String test() {
  String driver = attributes.getProperty("driver", "");
  String url = attributes.getProperty("url", "");
  String user = attributes.getProperty("user", "");
  String password = attributes.getProperty("password", "");
  session.put("driver", driver);
  session.put("url", url);
  session.put("user", user);
  boolean isH2 = url.startsWith("jdbc:h2:");
  try {
    Connection conn = server.getConnection(driver, url, user, password, this);
    JdbcUtils.closeSilently(conn);
    session.put("error", "${text.login.testSuccessful}");
    return "login.jsp";
  } catch (Exception e) {
    session.put("error", getLoginError(e, isH2));
    return "login.jsp";
  }
}

代码示例来源:origin: com.eventsourcing/h2

private String login() {
  String driver = attributes.getProperty("driver", "");
  String url = attributes.getProperty("url", "");
  String user = attributes.getProperty("user", "");
  String password = attributes.getProperty("password", "");
  session.put("autoCommit", "checked");
  session.put("autoComplete", "1");
  session.put("maxrows", "1000");
  boolean isH2 = url.startsWith("jdbc:h2:");
  try {
    Connection conn = server.getConnection(driver, url, user, password);
    session.setConnection(conn);
    session.put("url", url);
    session.put("user", user);
    session.remove("error");
    settingSave();
    return "frame.jsp";
  } catch (Exception e) {
    session.put("error", getLoginError(e, isH2));
    return "login.jsp";
  }
}

代码示例来源:origin: org.wowtools/h2

private String login() {
  String driver = attributes.getProperty("driver", "");
  String url = attributes.getProperty("url", "");
  String user = attributes.getProperty("user", "");
  String password = attributes.getProperty("password", "");
  session.put("autoCommit", "checked");
  session.put("autoComplete", "1");
  session.put("maxrows", "1000");
  boolean isH2 = url.startsWith("jdbc:h2:");
  try {
    Connection conn = server.getConnection(driver, url, user, password);
    session.setConnection(conn);
    session.put("url", url);
    session.put("user", user);
    session.remove("error");
    settingSave();
    return "frame.jsp";
  } catch (Exception e) {
    session.put("error", getLoginError(e, isH2));
    return "login.jsp";
  }
}

代码示例来源:origin: com.h2database/com.springsource.org.h2

boolean isH2 = url.startsWith("jdbc:h2:");
try {
  Connection conn = server.getConnection(driver, url, user, password, this);
  session.setConnection(conn);
  session.put("url", url);

代码示例来源:origin: org.wowtools/h2

Connection conn;
try {
  conn = server.getConnection(driver, url, user, password);
} finally {
  prof.stopCollecting();

代码示例来源:origin: com.eventsourcing/h2

Connection conn;
try {
  conn = server.getConnection(driver, url, user, password);
} finally {
  prof.stopCollecting();

相关文章

微信公众号

最新文章

更多