* Bonjour, *

je veux exporter une table d'une base de donnée mysql à travers un programme java je procède comme suit:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
void Sauvegarder()
    {
        JFileChooser filechoose = new JFileChooser();
        filechoose.setCurrentDirectory(new File("."));
        String approve = new String("ENREGISTRER");
        int resultatEnregistrer = filechoose.showDialog(filechoose,approve);
        if (resultatEnregistrer ==JFileChooser.APPROVE_OPTION)
        { String monFichier= new String(filechoose.getSelectedFile().toString());
           if(monFichier.endsWith(".sql")|| monFichier.endsWith(".sql"))
           {
               ;
           }
           else
               monFichier = monFichier+ ".sql";
 
        String cmd="cmd /c mysqldump -u "+user+" -p"+password+" --opt nom_de_la_table -h "+ip+" > "+monFichier;
 
        Runtime r =Runtime.getRuntime();
        try {
            Process p = r.exec(cmd);
            p.waitFor();
        } catch (IOException e) {
            System.out.println(e.toString());
        } catch (InterruptedException e) {
            System.out.println(e.toString());
        }
        System.out.println("sauvegarde effectuée");
        }
    }

le fichier crée est vide

* Merci *