Code example for Connection

Methods: getMetaData

0
  public static int verticaVersion(Configuration conf, boolean output) throws IOException {
    int ver = -1;
    try { 
    VerticaConfiguration vtconfig = new VerticaConfiguration(conf);
    Connection conn = vtconfig.getConnection(output);
    DatabaseMetaData dbmd = conn.getMetaData();
    ver = dbmd.getDatabaseMajorVersion() * 100;
    ver += dbmd.getDatabaseMinorVersion();
    } catch(ClassNotFoundException e) { 
      throw new IOException("Vertica Driver required to use Vertica Input or Output Formatters"); 
    } catch (SQLException e) { throw new IOException(e); }
    return ver;
  } 
   
  public static void checkOutputSpecs(Configuration conf) throws IOException {
    VerticaConfiguration vtconfig = new VerticaConfiguration(conf);
 
    String writerTable = vtconfig.getOutputTableName();
    if (writerTable == null)
      throw new IOException("Vertica output requires a table name defined by "
          + VerticaConfiguration.OUTPUT_TABLE_NAME_PROP);