Advertisement
Guest User

Erro Importar SQL com JavaSwing

a guest
Mar 9th, 2017
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.96 KB | None | 0 0
  1. private void btnCarregarBackupActionPerformed(java.awt.event.ActionEvent evt) {                                                  
  2.         String caminhoArquivo = txtCaminho.getText();
  3.  
  4.         try {
  5.             if (caminhoArquivo.length() == 0) {
  6.                 mm.msgInfo("Informação", "Informe o caminho do arquivo.");
  7.                 btnProcurarArquivo.requestFocus();
  8.             } else if (caminhoArquivo.length() > 0) {
  9.                 String cmdDOS = "cmd /c mysql -uUser2478 -pUser2478pass numeradortemp < " + caminhoArquivo;
  10.  
  11.                 Runtime r = Runtime.getRuntime();
  12.                 Process p = r.exec(cmdDOS);
  13.                 p.waitFor();
  14.  
  15.                 mm.msgSucesso("Sucesso", "Dados temporários importados com sucesso."); // mensagem personalizada
  16.             }
  17.  
  18.         } catch (IOException | InterruptedException e) {
  19.             mm.msgErro("Erro", "Motivo: " + e); // é aqui que ele para, exibindo a exceção
  20.         }
  21.  
  22.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement