Advertisement
Guest User

sKwa

a guest
Jul 23rd, 2013
312
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.02 KB | None | 0 0
  1. // daniel aka sKwa
  2.  
  3. import java.sql.*;
  4. import java.util.Properties;
  5.  
  6. public class Runtimecap {
  7.  
  8.     public static void main(String[] args) {
  9.  
  10.         try {
  11.  
  12.             Class.forName("com.vertica.jdbc.Driver");
  13.  
  14.         } catch (ClassNotFoundException e) {
  15.  
  16.             System.err.println("Could not find the JDBC driver class.");
  17.             e.printStackTrace();
  18.             return;
  19.  
  20.         }
  21.  
  22.         Properties myProp = new Properties();
  23.         myProp.put("user", "daniel");
  24.         myProp.put("password", "a");
  25.         myProp.put("ConnSettings", "SET SESSION RUNTIMECAP '10 minutes'");
  26.         Connection conn;
  27.  
  28.         try {
  29.             String conn_str = "jdbc:vertica://localhost:5433/sampler";
  30.             conn = DriverManager.getConnection( conn_str, myProp);
  31.             Statement stmt = conn.createStatement();
  32.             ResultSet rs = null;
  33.             rs = stmt.executeQuery("SHOW RUNTIMECAP");
  34.             System.out.print("Query reports that RUNTIMECAP is set to: ");
  35.  
  36.             while (rs.next()) {
  37.                 System.out.println(rs.getString(2).trim());
  38.             }
  39.  
  40.  
  41.             conn.close();
  42.  
  43.         } catch (SQLException e) {
  44.             e.printStackTrace();
  45.         }
  46.     }
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement