Exemple #1
0
  public void test_o() throws Exception {
    {
      Connection[] connections = new Connection[3];
      for (int i = 0; i < connections.length; ++i) {
        connections[i] = dataSource.getConnection();
      }

      for (int i = 0; i < connections.length; ++i) {
        Statement stmt = connections[i].createStatement();
        ResultSet rs = stmt.executeQuery("select now()");
        JdbcUtils.printResultSet(rs);
        rs.close();
        stmt.close();
      }

      for (int i = 0; i < connections.length; ++i) {
        connections[i].close();
      }
    }

    Thread.sleep(1000 * 60 * 60 * 6); // 6 hours
    Connection conn = dataSource.getConnection();

    Statement stmt = conn.createStatement();
    ResultSet rs = stmt.executeQuery("select now()");
    JdbcUtils.printResultSet(rs);
    rs.close();
    stmt.close();

    conn.close();
  }
  public void test_0() throws Exception {
    //        ResultSet rs = conn.getMetaData().getTables(null, null, null, null);
    //        JdbcUtils.printResultSet(rs);

    String sql = "select benchmark( 1, sha1( 'test' ) )";
    Statement stmt = conn.createStatement();

    ResultSet rs = stmt.executeQuery(sql);
    JdbcUtils.printResultSet(rs);

    stmt.close();
  }
Exemple #3
0
 public static void printResultSet(ResultSet rs, PrintStream out) throws SQLException {
   printResultSet(rs, out, true, "\t");
 }
Exemple #4
0
 public static void printResultSet(ResultSet rs) throws SQLException {
   printResultSet(rs, System.out);
 }