資源簡介
本火車訂票系統帶有數據庫文件,源代碼,課程設計報告,功能包括用戶注冊,用戶登錄,用戶根據需要進行查詢車票,下單訂票,退訂車票,改簽車票功能,在列車購買商品(礦泉水零食等)
代碼片段和文件信息
package?hello;
import?java.sql.*;
public?class?DB?{
String?driverName=“com.microsoft.sqlserver.jdbc.SQLServerDriver“;
String?dbURL=“jdbc:sqlserver://127.0.0.1:1433;DatabaseName=訂票系統數據庫“;
String?userName=“sa“;
String?userPwd=“123“;
Connection?con;
ResultSet?rs=null;
Statement?stmt;
public?void?init()?{
try{Class.forName(driverName);}?catch(Exception?e){e.printStackTrace();}
try{
con=DriverManager.getConnection(dbURLuserNameuserPwd);
System.out.println(“連接數據庫成功!“);
stmt=con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVEResultSet.CONCUR_READ_ONLY);
rs=stmt.executeQuery(“select?*?from?stu“);
while(rs.next())?{??//輸出數據庫數據
????System.out.print(rs.getString(“id“));
????System.out.println(rs.getString(“name“));
}
????
}catch(Exception?e)
{
????e.printStackTrace();
????System.out.print(“SQL?Server連接失敗!“);
}?
}
public?ResultSet?executeQuery(String?sql)?{
try?{
rs?=?stmt.executeQuery(sql);
}?catch?(SQLException?e)?{
e.printStackTrace();
}
return?rs;
}
public?ResultSet?executeQuery2(String?sql)?{
try?{
rs?=?stmt.executeQuery(sql);
}?catch?(SQLException?e)?{
e.printStackTrace();
}
return?rs;
}
public?int?executeUpdate(String?sql)?{
int?result=0;
try?{
result=stmt.executeUpdate(sql);
}?catch?(SQLException?e)?{
e.printStackTrace();
}
return?result;
}
public?void?close()?{
try?{
if(rs!=null)?rs.close();
if(stmt!=null)?stmt.close();
if(con!=null)?con.close();
}?catch?(SQLException?e)?{
e.printStackTrace();
}
}
}
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2020-04-21?20:29??4_SqlServer\
?????文件?????????978??2019-06-02?12:12??4_SqlServer\.classpath
?????文件?????????911??2019-06-14?11:58??4_SqlServer\.project
?????目錄???????????0??2020-04-21?20:29??4_SqlServer\.settings\
?????文件?????????567??2019-06-01?16:09??4_SqlServer\.settings\.jsdtscope
?????文件?????????364??2019-06-01?16:09??4_SqlServer\.settings\org.eclipse.jdt.core.prefs
?????文件?????????461??2019-06-01?16:09??4_SqlServer\.settings\org.eclipse.wst.common.component
?????文件?????????345??2019-06-01?16:09??4_SqlServer\.settings\org.eclipse.wst.common.project.facet.core.xm
?????文件??????????49??2019-06-01?16:09??4_SqlServer\.settings\org.eclipse.wst.jsdt.ui.superType.container
?????文件???????????6??2019-06-01?16:09??4_SqlServer\.settings\org.eclipse.wst.jsdt.ui.superType.name
?????目錄???????????0??2020-04-21?20:29??4_SqlServer\build\
?????目錄???????????0??2020-04-21?20:29??4_SqlServer\build\classes\
?????目錄???????????0??2020-04-21?20:29??4_SqlServer\build\classes\hello\
?????文件????????2657??2019-07-03?19:42??4_SqlServer\build\classes\hello\DB.class
?????文件????????1891??2019-07-03?19:42??4_SqlServer\build\classes\hello\Main.class
?????文件??????900894??2019-06-01?16:16??4_SqlServer\build\sqljdbc41.jar
?????目錄???????????0??2020-04-21?20:29??4_SqlServer\src\
?????目錄???????????0??2020-04-21?20:29??4_SqlServer\src\hello\
?????文件????????1679??2019-06-25?16:12??4_SqlServer\src\hello\DB.java
?????文件?????????962??2019-06-24?20:04??4_SqlServer\src\hello\Main.java
?????目錄???????????0??2020-04-21?20:29??4_SqlServer\WebContent\
?????文件?????????578??2019-06-25?09:47??4_SqlServer\WebContent\login.jsp
?????文件????????2981??2019-07-01?11:18??4_SqlServer\WebContent\login_check.jsp
?????目錄???????????0??2020-04-21?20:29??4_SqlServer\WebContent\me
?????文件??????????39??2019-06-01?16:09??4_SqlServer\WebContent\me
?????目錄???????????0??2020-04-21?20:29??4_SqlServer\WebContent\page\
?????文件??????821583??2019-06-13?19:12??4_SqlServer\WebContent\page\zz2.png
?????文件?????????838??2019-06-29?11:08??4_SqlServer\WebContent\register.jsp
?????文件????????1365??2019-06-29?12:42??4_SqlServer\WebContent\register_end.jsp
?????文件????????1848??2019-06-29?14:49??4_SqlServer\WebContent\success.jsp
?????文件????????3107??2019-07-03?23:30??4_SqlServer\WebContent\ticket.jsp
............此處省略53個文件信息
- 上一篇:Java Web系列課程教學網站
- 下一篇:LoginDemo.zip
評論
共有 條評論