menembus batas impian


Assalamu’alaikum wr wb.

sekedar berbagi dan menyimpan ilmu dalam postingan pertama di blog baru ini.
script ini berhasil aku jalankan di project java pertamaku
semoga bermanfaat. salam kenal. Wassalamu’alaikum wr wb

private void Button2ActionPerformed(java.awt.event.ActionEvent evt) {
//// backup database pertama
try {
String host=”localhost”,user=”root”,pw=”admin”;
File test=new File(“E:\\test.sql”);
FileWriter fw=null;
try{
fw = new FileWriter(test);
Runtime rt = Runtime.getRuntime();
Process child = rt.exec(“E:/nunkafsys_data/bin/mysqldump  -h”+host+” -u”+user+” -p”+pw+” databasepertama”);

InputStream in = child.getInputStream();
InputStreamReader xx = new InputStreamReader(in,”latin1″);
char[] chars=new char[1024];
int ibyte=0;
while((ibyte=xx.read(chars))>0)
{
fw.write(chars);
}
fw.close();
}catch (Exception e) {

e.printStackTrace();
}
//// backup database kedua
File test2=new File(“E:\\test2.sql”);
FileWriter fw2=null;
try{
fw2 = new FileWriter(test2);
Runtime rt = Runtime.getRuntime();
Process child2 = rt.exec(“E:/nunkafsys_data/bin/mysqldump  -h”+host+” -u”+user+” -p”+pw+” databasekedua”);

InputStream in2 = child2.getInputStream();
InputStreamReader xx2 = new InputStreamReader(in2,”latin1″);
char[] chars=new char[1024];
int ibyte=0;
while((ibyte=xx2.read(chars))>0)
{
fw2.write(chars);
}
fw2.close();
}catch (Exception e2) {

e2.printStackTrace();
}
}

Tinggalkan Balasan

Isikan data di bawah atau klik salah satu ikon untuk log in:

Logo WordPress.com

You are commenting using your WordPress.com account. Logout / Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout / Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout / Ubah )

Foto Google+

You are commenting using your Google+ account. Logout / Ubah )

Connecting to %s

%d blogger menyukai ini: