code: private void stage1(ProtoNetwork gpn) {
          beginStage(PHASE4_STAGE1_HDR, "1", numPhases);
          final StringBuilder bldr = new StringBuilder();
  
          final String kamURL = sysconfig.getKamURL();
          final String kamUser = sysconfig.getKamUser();
          final String kamPass = sysconfig.getKamPassword();
  
          // stageOutput("Building KAM at - " + kamURL);
          DBConnection dbc = null;
          try {
              dbc = p4.stage1ConnectKAMStore(kamURL, kamUser, kamPass);
          } catch (DBConnectionFailure e) {
              e.printStackTrace();
              stageError(e.getUserFacingMessage());
              exit(ExitCode.KAM_CONNECTION_FAILURE);
          }
  
          KamDbObject kamDb = new KamDbObject(null, kamName, kamDescription,
                  new Date(), null);
  
          String kamSchemaName = null;
          try {
              kamSchemaName = p4.stage2SaveToKAMCatalog(kamDb);
          } catch (KAMCatalogFailure e) {
              e.printStackTrace();
              stageError(e.getUserFacingMessage());
              exit(ExitCode.KAM_CONNECTION_FAILURE);
          }
  
          try {
              p4.stage3CreateKAMstore(dbc, kamSchemaName);
          } catch (CreateKAMFailure e) {
              e.printStackTrace();
              stageError("Unable to build KAM store - " + e.getMessage());
              exit(ExitCode.KAM_CONNECTION_FAILURE);
          }
  
          try {
              p4.stage4LoadKAM(dbc, gpn, kamSchemaName);
          } catch (DatabaseError e) {
              stageError("Unable to load KAM.");
              stageError(e.getUserFacingMessage());
              exit(ExitCode.KAM_LOAD_FAILURE);
          } catch (CreateKAMFailure e) {
              stageError("Unable to build KAM store - " + e.getMessage());
              exit(ExitCode.KAM_CONNECTION_FAILURE);
          }
  
          markEndStage(bldr);
      }
docs: Stage one connection to KAM store.
  
  @return {@link DBConnection}, the KAM DB connection