Dear jugers, mohon bantuan para master sekalian untuk function restore mysql, cos udah stuck. Saya sudah coba di command line berhasil tetapi bila saya jalankan melalui runtime.exec() koq tidak jalan.
berikut source yang saya pake: fc.setDialogTitle("Restore Database"); FileNameExtensionFilter filter = new FileNameExtensionFilter( ".sql File", "sql"); fc.setFileFilter(filter); int code = fc.showOpenDialog(desktopPane); if(code == JFileChooser.APPROVE_OPTION){ String fileName = fc.getSelectedFile().getAbsolutePath(); String executeCmd = "mysql -uroot -padmin --database=wahana < \""+fileName+"\""; try { InputStreamReader irs = new InputStreamReader( Runtime.getRuntime().exec(executeCmd).getInputStream() ); System.out.println(executeCmd); BufferedReader br = new BufferedReader(irs); String line = br.readLine(); while (line != null) { System.out.println(line); line = br.readLine(); } hanya menghasilkan seperti ini: mysql Ver 14.14 Distrib 5.1.37, for Win32 (ia32) Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc. This software comes with ABSOLUTELY NO WARRANTY. This is free software, and you are welcome to modify and redistribute it under the GPL license Usage: mysql [OPTIONS] [database] bla...bla...bla.... seperti pada command line kalo kita salah kasih command nya. Hasil dari googling sich disaranin pake file bat, cuman saya bingung apakah file bat dapat menerima parameter? cos filename-nya kan selau berubah-ubah. Best Regards, Satriyo Prahoro