package com.zky.util; public class Test { public static void backup(String dbName, String filePath) { try { @SuppressWarnings("unused") Process process = Runtime.getRuntime().exec( "cmd /c mysqldump -uroot -proot " + dbName + " > " + filePath + "/" + new java.util.Date().getTime() + ".sql"); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } } @SuppressWarnings("unused") // �ָ����ݿ� public static void load(String dbName, String filePath) { try { @SuppressWarnings("unused") Process process = Runtime.getRuntime().exec( "cmd /c mysql -uroot -psa " + dbName + " < " + filePath); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } } public static void main(String[] args) { try { backup("orcl","d:/"); //oad("test", "d:/1259138711453.sql"); System.out.println("ok"); } catch (Exception e) { // TODO: handle exception e.getMessage(); } } }