代碼:火車票預(yù)訂系統(tǒng)的設(shè)計與實現(xiàn)

代碼:火車票預(yù)訂系統(tǒng)的設(shè)計與實現(xiàn)

ID:17912187

大?。?67.00 KB

頁數(shù):39頁

時間:2018-09-09

代碼:火車票預(yù)訂系統(tǒng)的設(shè)計與實現(xiàn)_第1頁
代碼:火車票預(yù)訂系統(tǒng)的設(shè)計與實現(xiàn)_第2頁
代碼:火車票預(yù)訂系統(tǒng)的設(shè)計與實現(xiàn)_第3頁
代碼:火車票預(yù)訂系統(tǒng)的設(shè)計與實現(xiàn)_第4頁
代碼:火車票預(yù)訂系統(tǒng)的設(shè)計與實現(xiàn)_第5頁
資源描述:

《代碼:火車票預(yù)訂系統(tǒng)的設(shè)計與實現(xiàn)》由會員上傳分享,免費在線閱讀,更多相關(guān)內(nèi)容在行業(yè)資料-天天文庫

1、火車票預(yù)定系統(tǒng)的設(shè)計與實現(xiàn)目錄第一部分功能代碼-1-1.DBO.java-1-2.Log.java-4-3.MD5.java-5-4.Common.java-6-5.CheckCode.java-8-6.LoginServlet.java-9-7.TrainBean.java-13-第二部分外部顯示代碼-24-1.index.jsp-24-2.login.jsp-27-3.error.jsp-31-4.index.jsp-32-5.index.jsp-35-I火車票預(yù)定系統(tǒng)的設(shè)計與實現(xiàn)第一部分內(nèi)部功能代碼1.DBO.javapackagecom.util;i

2、mportjava.sql.*;importjava.sql.DriverManager;importjava.sql.ResultSet;importjava.sql.SQLException;importjavax.activation.DataSource;importjava.sql.*;importjava.sql.DriverManager;importjava.sql.ResultSet;importjava.sql.SQLException;importjava.sql.Statement;importjavax.naming.Context

3、;importjavax.naming.InitialContext;publicclassDBO{privateConnectionconn;privateStatementstmt;privateDataSourceds;publicDBO(){}/**打開數(shù)據(jù)庫*/publicvoidopen(){try{Class.forName("org.gjt.mm.mysql.Driver");conn=軟件職業(yè)技術(shù)學(xué)院062402班斯明學(xué)號:20063342-38-火車票預(yù)定系統(tǒng)的設(shè)計與實現(xiàn)DriverManager.getConnection("jdbc:

4、mysql://localhost:3306/cpyd?user=root&password=siming&useUnicode=true&characterEncoding=GBK");stmt=conn.createStatement();System.out.println("打開數(shù)據(jù)庫連接");}catch(Exceptionex){System.err.println("打開數(shù)據(jù)庫時出錯:"+ex.getMessage());}}/**關(guān)閉數(shù)據(jù)庫,將連接返還給連接池*/publicvoidclose(){try{//connMgr.freeConn

5、ection("java",conn);conn.close();System.out.println("釋放連接");}catch(SQLExceptionex){System.err.println("返還連接池出錯:"+ex.getMessage());}}/**執(zhí)行查詢*/publicResultSetexecuteQuery(Stringsql)throwsSQLException{ResultSetrs=null;rs=stmt.executeQuery(sql);System.out.println("執(zhí)行查詢");returnrs;}/**軟

6、件職業(yè)技術(shù)學(xué)院062402班斯明學(xué)號:20063342-38-火車票預(yù)定系統(tǒng)的設(shè)計與實現(xiàn)執(zhí)行增刪改*/publicintexecuteUpdate(Stringsql)throwsSQLException{intret=0;ret=stmt.executeUpdate(sql);System.out.println("執(zhí)行增刪改");returnret;}/**將SQL語句加入到批處理*/publicvoidaddBatch(Stringsql)throwsSQLException{stmt.addBatch(sql);}/**執(zhí)行批處理*/publicin

7、t[]executeBatch()throwsSQLException{booleanisAuto=conn.getAutoCommit();conn.setAutoCommit(false);int[]updateCounts=stmt.executeBatch();//conn.commit();//conn.setAutoCommit(isAuto);//conn.setAutoCommit(true);returnupdateCounts;}publicbooleangetAutoCommit()throwsSQLException{returnco

8、nn.getAutoCommit();}public

當(dāng)前文檔最多預(yù)覽五頁,下載文檔查看全文

此文檔下載收益歸作者所有

當(dāng)前文檔最多預(yù)覽五頁,下載文檔查看全文
溫馨提示:
1. 部分包含數(shù)學(xué)公式或PPT動畫的文件,查看預(yù)覽時可能會顯示錯亂或異常,文件下載后無此問題,請放心下載。
2. 本文檔由用戶上傳,版權(quán)歸屬用戶,天天文庫負(fù)責(zé)整理代發(fā)布。如果您對本文檔版權(quán)有爭議請及時聯(lián)系客服。
3. 下載前請仔細(xì)閱讀文檔內(nèi)容,確認(rèn)文檔內(nèi)容符合您的需求后進(jìn)行下載,若出現(xiàn)內(nèi)容與標(biāo)題不符可向本站投訴處理。
4. 下載文檔時可能由于網(wǎng)絡(luò)波動等原因無法下載或下載錯誤,付費完成后未能成功下載的用戶請聯(lián)系客服處理。