java ±¸·ÝºÍ»Ö¸´PostgreSQLÊý¾Ý¿â - Java / Web ¿ª·¢
Êý¾Ý¿â·þÎñÆ÷192.168.0.123
Óû§Ãû£ºpostgres
ÃÜÂ룺postgres
Êý¾Ý¿âÃû£ºmydb
web³ÌÐò£¬ÔÚÍøÒ³Éϱ¸·Ý·þÎñÆ÷ÉϵÄÊý¾Ý¸ÃÔõôд£¿
²é×ÊÁÏ´ó¶à˵ÓÃpg_dumpдbatÎļþÀ´ÓÃjavaÖ´ÐС£µ«ÊDZ¸·ÝÔ¶³Ì·þÎñÆ÷µÄÊý¾Ý¿â¸ÃÈçºÎʵÏÖ£¿
ÎÒµ¥¶ÀдÁËbatÎļþ±¸·Ý±¾»úµÄÊý¾Ý¾Ö£¬·Åµ½×ÀÃæÉÏÖ´Ðгɹ¦£¬Ð´ÔÚjava³ÌÐòÖÐÍøÒ³ÔËÐÐÈ´²»ÐУ¡
bakup.batÎļþÄÚÈÝ
cd C:\Program Files\PostgreSQL\8.2\bin\
CLS
pg_dump -h 127.0.0.1 -U postgres -p 5432 -D test > d:\temp\mydb.sql
pause
javaµÄaction
Java code:
public String addDBbak() throws Exception {
//Êý¾Ý¿â±¸·Ý
BufferedWriter mBufWriter = null;
//½¨Á¢Ò»¸öBackupDb.batÎļþ
FileWriter fileWriter = new FileWriter("BackupDb.bat");
mBufWriter = new BufferedWriter(fileWriter);
/*
* °ÑÊý¾Ý¿â±¸·Ý·½·¨Ð´ÈëBackupDb.batÎļþÖС£
* BackupDbUrl ÊÇÊý¾Ý¿â±¸·ÝÃüÁî¡£
* pg_dump.exe -U postgres -E utf8 test ±¸·ÝÊý¾Ý¿âÃüÁî¡£
* —U postgres Êý¾Ý¿âÓû§Ãû -E utf8 É趨×Ö·û±àÂë¸ñʽ¡£test Êý¾Ý¿âÃû
* BackupDbName ±¸·ÝÎļþËù´æĿ¼ºÍÃû³Æ£¬ÎÒÊÇÒÔ±¸·Ýʱ¼äÃüÃû¡£
*/
String BackupDbUrl="c:\\Program Files\\PostgreSQL\\8.2\\bin\\pg_dump -h 127.0.0.1 -p 5432 -U postgres -W postgres -E utf-8 -d mydb>&
Ïà¹ØÎÊ´ð£º
JSPÒ³ÃæÖÐÓжà¸öradio°´Å¥
JSPÒ³Ã潫²ÎÊýPOST¸øservlet
ÒªÇóÈçÏÂ;
1.Ñ¡ÔñÒ»¸öradio£¬µ÷ÓÃservlet servletÖиù¾Ý²ÎÊýµ÷ÓÃÆäËû½Ó¿Ú£¬³ý·ÇÑ¡ÖиÃradio²¢µã»÷JSPÖеÄʵР......
ÎÒÊǸöÐÂÊÖ£¬Íû¸ßÊÖ½â´ð
ÎÒÏÖÔÚÒѾ°²×°ÁËmysql£¬Ò²ÓÐmysqlµÄjdbc¡£µ«ÎÒÔõôÅäÖú󣬲ÅÄÜÔÚMyEclipseÀï²Ù×÷mysqlÄØ£¿Çë¸ßÊÖ˵Ïêϸµã
´ò¿ªMyeclipse----window---open perspective---MyEclipse database explorer-- ......
ÔھƵê¹ÜÀíϵͳÖÐ,ÓÐÒ»¸ö¶ÔÄÚµÄϵͳ,¹©Ç°Ì¨·þÎñÔ±ºÍ¾ÀíʹÓÃ
»¹ÓÐÒ»¸ö¾ÍÊǶÔÍâ,Èÿͻ§¿ÉÒÔÔÚÍøÉÏÔ¤¶©·¿¼ä,
ËüÃÇÖ®¼äÊÇÔõôͨѶµÄ.?µ±ÎÒÌá½»Ô¤¶©·¿¼äÐÅÏ¢µÄʱºò,
ÔÚ¶ÔÄÚµÄϵͳÖÐ,ÈçºÎÖªµÀÎÒÒѾÌá½»ÁËÐÅÏ¢¹ýÈ¥.Ê¹Ç ......
¾ÍÊǼòµ¥µÄ´«ÖµºÍÈ¡Öµ
ÇëÎÊÂ¥Ö÷ÏëÎÊʲô£¿
jspÒ³Ãæ²ÉÓÃ±íµ¥»òÕßjavabean´«Öµ¶¼¿ÉÒÔ£¬Ê¹ÓÃrequest.getParameter()»ñµÃʹÓÃ±íµ¥´«¹ýÀ´µÄÖµ¡£
ÎÊÎÊÌ⣬ÏÈ°ÑÎÊÌâ˵Çå³þµã£¡£¡ ÎÊÌâÌ«Ä£ºý£¡£¡
ÎÊÎÊÌ⣬ÏÈ°ÑÎ ......