W
wanpeng
Unregistered / Unconfirmed
GUEST, unregistred user!
mysqldump.exe -u root -pmanager== --default-character-set=GBK --ignore-table=psykey.materialtable psykey>db.dmp
直接写这个语句执行不行,好像不认“>”符号,换成流的方式:
FileOutputStream fos= new FileOutputStream(filepath);
Runtime rt = Runtime.getRuntime();
Process proc = rt.exec("mysqldump.exe -u root -pmanager== --default-character-set=GBK --ignore-table=psykey.materialtable psykey"
GripStream errorGobbler = new GripStream(proc.getErrorStream(), "ERROR"
GripStream outputGobbler = new GripStream(proc.getInputStream(), "OUTPUT", fos);
errorGobbler.start();
outputGobbler.start();
int exitVal = proc.waitFor();
if (exitVal == 0)
{
rtn = true;
}
fos.flush();
fos.close();
proc.destroy();
但是这样的话,第一次有时候可以,以后都不行,备份的文件大小不对。
请有经验的高手来指点一下迷津吧,谢了!
直接写这个语句执行不行,好像不认“>”符号,换成流的方式:
FileOutputStream fos= new FileOutputStream(filepath);
Runtime rt = Runtime.getRuntime();
Process proc = rt.exec("mysqldump.exe -u root -pmanager== --default-character-set=GBK --ignore-table=psykey.materialtable psykey"
GripStream errorGobbler = new GripStream(proc.getErrorStream(), "ERROR"
GripStream outputGobbler = new GripStream(proc.getInputStream(), "OUTPUT", fos);
errorGobbler.start();
outputGobbler.start();
int exitVal = proc.waitFor();
if (exitVal == 0)
{
rtn = true;
}
fos.flush();
fos.close();
proc.destroy();
但是这样的话,第一次有时候可以,以后都不行,备份的文件大小不对。
请有经验的高手来指点一下迷津吧,谢了!