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>&
Ïà¹ØÎÊ´ð£º
µ±ÖªµÀÒ»¸öÈÕÆÚ£¬ÈçºÎ°ÑÕâ¸öÈÕÆÚËùÔÚÑ®µÄÇ°ºóÁ½¸öÈÕÆÚÈ¡³ö
±ÈÈçÊäÈë20090905£¬¾ÍÊäÈë20090901 20090910
Êä³ö20090901 20090910
È¡µÃÌìÊýºó×÷Ò»ÏÂÅжÏÔÙ°ÑÕâ¸ö·½·¨ÓÃÏÂvoid set(int field, int value)
......
ÎÒJSPµÄÒ³ÃæÊÇ£º
<%@ page language="java" contentType="text/html; charset=gb2312"
%>
<script>
function Save(){
xmlHttp=GetXmlHttpObject()
if(xmlHttp==nul ......
insert into [ScholarshipManagement].[dbo].[department] ([department],[specialization] ,[grade]) output inserted.departmentID values(? ,? ,? )
ÇëÎÊ´ó¸çÃÇÕâ¸ösql Óï¾äÓ¦¸ÃÓÃJavaÀïµÄÄǸöÊý¾Ý¿â²Ù×÷·½·¨£¿ ......
ÔõôÑù½«id´«¹ýÈ¥°¡£¿£¿£¿ÊǼòµ¥µÄ´«¡£¡£¡£ÔÚµØÖ·À¸ÖÐдidºÅ
LZ ºÃÓÄĬ£¡²»ÖªµÀÄãµÄÒâ˼£¿
ÊÇÏë°ÑID ´«µ½ACTION ? ͨ¹ýURl id=?
²»¹»Ïêϸ ±ðÈ˲»ÖªµÀÔõÑù°ïÄã
../XXXXX.do?id=XXXX&id2=XXXXX
......
ÓÃStruts2+Spring+Hibernate×öµÄÒ»¸öwebµÄERPСÏîÄ¿£¬×ܲ¿Ò»Ì¨·þÎñÆ÷£¨Êý¾Ý¿âÓëWeb·þÎñÆ÷ÔÚͬһ»ú×ÓÉÏ£©Êǵ¥¶À²¦ºÅÉÏÍøµÄ£¬Óë·Ö¹«Ë¾Ã»ÓÐÓþÖÓòÍøÏߣ¬Ó²¼þÌ«¹óÁË£¬ÆäËû¼¸¸öÊ¡Êзֹ«Ë¾¶¼À´·ÃÎÊÕâÒ»·þÎñÆ÷£¬¸Ð¾õºǫ́´ú ......