學生宿舍管理系統(tǒng)的設(shè)計(SQL數(shù)據(jù)庫課程設(shè)計)_第1頁
學生宿舍管理系統(tǒng)的設(shè)計(SQL數(shù)據(jù)庫課程設(shè)計)_第2頁
學生宿舍管理系統(tǒng)的設(shè)計(SQL數(shù)據(jù)庫課程設(shè)計)_第3頁
學生宿舍管理系統(tǒng)的設(shè)計(SQL數(shù)據(jù)庫課程設(shè)計)_第4頁
學生宿舍管理系統(tǒng)的設(shè)計(SQL數(shù)據(jù)庫課程設(shè)計)_第5頁
已閱讀5頁,還剩23頁未讀, 繼續(xù)免費閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進行舉報或認領(lǐng)

文檔簡介

1、數(shù)據(jù)庫課程設(shè)計報告學生宿舍管理系統(tǒng)設(shè)計專業(yè)學生姓名班級學號指導(dǎo)教師完成日期目 錄1 課程設(shè)計目的及要求12 課程設(shè)計的主要內(nèi)容13數(shù)據(jù)庫設(shè)計23.1 概念設(shè)計23.2 邏輯設(shè)計33.3 物理設(shè)計54程序模塊設(shè)計64.1 登錄界面模塊設(shè)計64.2 按宿舍號、學生學號的查詢模塊設(shè)計84.3 按宿舍號、學生學號的統(tǒng)計模塊設(shè)計105 小結(jié)12附 錄13附錄1 源程序清單13學生宿舍管理系統(tǒng)的設(shè)計1 課程設(shè)計目的及要求 設(shè)計目的:1) 簡化宿舍管理人員手工記錄數(shù)據(jù)的繁瑣;2) 提高記錄查詢速度,縮短查詢時間;3) 實現(xiàn)數(shù)據(jù)的安全存儲。設(shè)計要求:1)要求用戶必須輸入正確的密碼才能進入系統(tǒng);2)實現(xiàn)按宿舍號

2、、學生學號的查詢。3)實現(xiàn)分別按宿舍號、學生學號的統(tǒng)計。 2 課程設(shè)計的主要內(nèi)容2.1 經(jīng)濟可行性分析系統(tǒng)的經(jīng)濟可行性分析是指對組織的經(jīng)濟狀況和投資能力進行分析,對系統(tǒng)的建設(shè)運營和維護費用進行估算,對系統(tǒng)建成后可能取得的社會及經(jīng)濟效益進行估計。由于本系統(tǒng)作為畢業(yè)設(shè)計,所以在資金上沒有太多的需求,只是需要系統(tǒng)開發(fā)者投入較多的時間,去進行研究和分析,以及思考問題的所在。2.2 技術(shù)可行性分析學生公寓管理系統(tǒng)使用SQL Sever 2017以及Java6.0進行開發(fā),由于Netbeans6.0的可視化模塊比較強大,所以在系統(tǒng)的設(shè)計過程中不會有太大問題,同該系統(tǒng)使用Macro Software的SQL

3、 server 2017對后臺的數(shù)據(jù)進行操作,使得數(shù)據(jù)完整性得以保證,同時數(shù)據(jù)操作簡單化。通過上述分析得出該系統(tǒng)在技術(shù)上是可行的。2.3 操作可行性分析本系統(tǒng)直觀易懂,使用非常方便,管理員經(jīng)過簡單的培訓(xùn)就可以熟練的使用,因此系統(tǒng)的操作沒有什么太大困難。3數(shù)據(jù)庫設(shè)計3.1 概念設(shè)計學生學號性別姓名年齡所屬學院入住寢室號居住性別寢室人數(shù)寢室N樓號房間數(shù)包含1管理宿舍樓N1管理員性別姓名員工號樓號N1樓號寢室號樓號 3.1.13.1.2 數(shù)據(jù)字典是各類數(shù)據(jù)描述的集合,它是進行詳細的數(shù)據(jù)收集和數(shù)據(jù)分析后所 收獲得的主要成果。數(shù)據(jù)字典通常包括以下5個部分:A 數(shù)據(jù)項:數(shù)據(jù)項是不可再分的數(shù)據(jù)單位。B 數(shù)據(jù)

4、結(jié)構(gòu):數(shù)據(jù)結(jié)構(gòu)反映了數(shù)據(jù)之間的組合關(guān)系。一個數(shù)據(jù)結(jié)構(gòu)可以由若干個數(shù)據(jù)項組成,也可以由若干個數(shù)據(jù)結(jié)構(gòu)組成,或由若干數(shù)據(jù)項和數(shù)據(jù)結(jié)構(gòu)混合組成。C 數(shù)據(jù)流:數(shù)據(jù)流是數(shù)據(jù)結(jié)構(gòu)在系統(tǒng)內(nèi)傳輸?shù)穆窂?。D 數(shù)據(jù)存儲:數(shù)據(jù)存儲是數(shù)據(jù)及其結(jié)構(gòu)停留或保存的地方,也是數(shù)據(jù)流的來源和去向之一。E 處理過程:處理過程的具體處理邏輯一般用判定表或判定樹來描述。數(shù)據(jù)字典是關(guān)于數(shù)據(jù)庫中數(shù)據(jù)的描述,即對元數(shù)據(jù)的描述。數(shù)據(jù)字典是在需求分析階段建立,在數(shù)據(jù)庫設(shè)計過程中不斷修改、充實、完善的。a. 數(shù)據(jù)項編號:E01數(shù)據(jù)項:管理員信息表描述:宿舍管理員的相關(guān)信息定義:管理員信息表=員工姓名+性別+員工號+管理的樓號b. 數(shù)據(jù)項編號:E

5、02數(shù)據(jù)項:宿舍樓信息表描述:宿舍樓的相關(guān)信息定義:宿舍樓信息表=宿舍樓號+宿舍數(shù)目c. 數(shù)據(jù)項編號:E03數(shù)據(jù)項:寢室信息表描述:學生寢室的相關(guān)信息定義:寢室信息表=寢室號+居住性別+寢室人數(shù)+樓號d. 數(shù)據(jù)項編號:E04數(shù)據(jù)項:學生信息表描述:學生的個人信息定義:學生信息表=學號+性別+姓名+年齡+所屬學院+居住樓號+寢室號3.2 邏輯設(shè)計分析后達到三范式后建立以下4個表:MANAGER_INFO 表 管理員信息FLOOR_INFO 表 宿舍樓信息ROOM_INFO 表 寢室信息STUDENT_INFO 表 學生信息一、管理員信息表(MANAGER_INFO) 管理員信息表字段名數(shù)據(jù)類型長

6、度說明描述mnameChar10不空,主鍵管理員姓名msexChar10不空性別mnumberInt4不空編號mlouInt4不空樓號二、宿舍樓信息表(FLOOR_INFO) 宿舍樓信息字段名數(shù)據(jù)類型長度說明描述mlouInt4不空樓號roomInt4不空房間數(shù)三、寢室信息表(ROOM_INFO)寢室信息字段名數(shù)據(jù)類型長度說明描述qnumberInt4不空,主鍵寢室號qsexChar10不空居住性別qcountInt4不空寢室人數(shù)mlouInt4不空樓號四、學生信息表(STUDENT_INFO) 學生信息字段名數(shù)據(jù)類型長度說明描述snumberInt4不空,主鍵學號snameChar10不空姓

7、名ssexChar10不空性別sageInt4不空年齡scollegeChar10不空所屬學院mlouInt4不空樓號qnumberInt4不空寢室號3.3 物理設(shè)計 數(shù)據(jù)庫的物理設(shè)計就是為邏輯數(shù)據(jù)模型選取一個最合適應(yīng)用要求的物理結(jié)構(gòu)的過程,在這個階段中要完成兩大任務(wù):(1)確定數(shù)據(jù)庫的物理結(jié)構(gòu),在關(guān)系數(shù)據(jù)庫中主要是存取方法和存儲結(jié)構(gòu);(2)對物理結(jié)構(gòu)進行評價,評價的重點是時間和空間效率。1、CREATE DATABASE data_baseON(NAME=data_base_Data,FILENAME=C:ProgrameFilesMicrosoftSQLServerMSSQLdatadat

8、a_base_Data.MDF,SIZE=10MB,MAXSIZE=50MB,FILEGROWTH=5MB) LOG ON(NAME=data_base_Log,FILENAME=C:Program FilesMicrosoft SQL ServerMSSQLdatadata_base_Log.LDF,SIZE=10MB,MAXSIZE=20MB,FILEGROWTH=5MB)2、CREATE TABLE MANAGER_INFO( mname char(10) not null primary key, msex char(10) not null, mnumber int(4) not n

9、ull, mlou int(4) not null)Go3、CREATE TABLE FLOOT_INFO ( mlou int(4) not null primary key,room int(4) not null)Go4、CREATE TABLE ROOM_INFO( qnumber int (4) not null primary key,qsex int (10) not null,qcount int (4) not null,mlou int (4) not null)Go5、CREATE TABLE STUDENT_INFO( snumber int (4) not null

10、primary key,sname char(10) not null,ssex char(10) not null,sage int (4) not null,scollege char(10) not null,mlou int (4) not null,qnumber int (4) not null)4程序模塊設(shè)計4.1 登錄界面模塊設(shè)計 功能需求:實現(xiàn)密碼正確時才可使用此系統(tǒng)。用戶界面設(shè)計:程序代碼設(shè)計和分析: 程序主界面由6個部分怎么組成,菜單欄5個按鈕分別三“按學號查詢”、“按宿舍號查詢”、“按學院統(tǒng)計”、“按宿舍號統(tǒng)計”、“幫助”,分別對應(yīng)各自的功能。初始狀態(tài)下5個按鈕都是無效

11、的,只有輸入正確的口令,功能才被激活。口令出錯時會出現(xiàn)“您輸入的密碼不正確”這樣的提示窗口。如果三次輸入錯誤,用戶會被禁用。運行結(jié)果:口令正確,窗口如下:口令錯誤,窗口如下:口令三次錯誤,用戶被禁用,窗口如下:4.2 按宿舍號、學生學號的查詢模塊設(shè)計功能需求:實現(xiàn)分別按宿舍號、學生學號查詢學生的相關(guān)信息。用戶界面設(shè)計: 程序代碼設(shè)計和分析: 由于按學號查詢跟按宿舍號查詢功能類似,所以以學號舉例。查詢之前首先需要建立與SQL的連接。 連接成功以后,使用String sql=select * from STUDENT_INFO where snumber=+t1.getText();進行查詢,使用

12、System.out.println(“”);在命令行中輸出。運行結(jié)果:按宿舍號查詢結(jié)果如下:按學號查詢結(jié)果如下:4.3 按宿舍號、學生學號的統(tǒng)計模塊設(shè)計功能需求:實現(xiàn)分別按宿舍號、學院進行統(tǒng)計。用戶界面設(shè)計: 程序代碼設(shè)計和分析:在文本框中輸入學院代號,1表示博雅學院,2表示化生學院,3表示機械學院,設(shè)置一個變量x表示相應(yīng)學院的住宿生人數(shù)。然后使用java命令行輸出表達式在DOS界面進行設(shè)計。 運行結(jié)果: 按宿舍號統(tǒng)計住宿生,結(jié)果如下: 按學院統(tǒng)計住宿生,結(jié)果如下:5 小結(jié)這次數(shù)據(jù)庫課程設(shè)計收獲頗豐。由于很多知識書本上沒有,所以使得我學要在網(wǎng)絡(luò)上尋找相應(yīng)的內(nèi)容,提高了我的知識查詢能力。在ja

13、va程序與sql數(shù)據(jù)庫連接上花了不少時間。首先安裝了SQL Sever 2000 JDBC 驅(qū)動程序,接著有對電腦本來的SQL Sever 2000 打上SP3補丁,安裝SP3驅(qū)動程序。另外,還得在java的目錄下粘貼msbase.jar,mssqlserver.jar,msutil.jar文件。最后在DOS環(huán)境中使用“ netstat an”查看端口1433是否打開,打開后才可以進行數(shù)據(jù)庫的連接。1433端口是java和sql數(shù)據(jù)庫進行連接的主要端口,該端口打開后也就意味著計算機給網(wǎng)絡(luò)中的不法分子提供了一個入侵漏洞,計算機受到不斷入侵會把用戶的cmd.exe進行攔截,以至于用戶不能打開DOS

14、界面。 附 錄附錄1 源程序清單import java.awt.*;import java.awt.event.*;import java.io.*;import javax.swing.JOptionPane;import java.sql.*;public class Zu extends Frame implements ActionListenerstatic int i=0; static int m=1;Label a1,a2;TextField text1;Button button1,m1,m2,m3,m4,m5;Font f;Zu(String s)super(s);setL

15、ayout(null);f=new Font(黑體,Font.BOLD,20);m1=new Button(按學號查詢);m2=new Button(按宿舍號查詢);m3=new Button(按學院統(tǒng)計);m4=new Button(按宿舍號統(tǒng)計);m5=new Button(幫助);m1.addActionListener(this);m2.addActionListener(this);m3.addActionListener(this);m4.addActionListener(this);m5.addActionListener(this);m1.setBounds(10,30,12

16、0,25);m2.setBounds(140,30,140,25); m3.setBounds(290,30,120,25); m4.setBounds(420,30,80,25);m5.setBounds(510,30,80,25);add(m1);add(m2);add(m3);add(m4);add(m5);a1=new Label(數(shù)據(jù)庫課程設(shè)計,Label.CENTER);a2=new Label(輸入口令:);a1.setBounds(180,100,300,40);a1.setBackground(Color.white);a1.setFont(f); a2.setBounds(

17、180,200,90,25); a2.setBackground(Color.white);text1=new TextField(18);text1.setBounds(280,200,200,25);button1=new Button(確認);button1.setBounds(300,250,70,30);button1.addActionListener(this);add(a1);add(a2);add(text1);add(button1);setBackground(Color.white);setBounds(100,100,600,400);setVisible(true)

18、;validate();addWindowListener(new WindowAdapter() public void windowClosing(WindowEvent e) System.exit(0); );public void actionPerformed(ActionEvent e) String s=new String();if(e.getSource()=button1) while(i=0&m=3)JOptionPane.showMessageDialog(this,您已被禁用,錯誤對話框,JOptionPane.ERROR_MESSAGE);if(i=1)if(e.

19、getSource()=m1)Show s1=new Show(按學號查詢信息);s1.setVisible(true);else if(e.getSource()=m2)Form3 f1=new Form3();f1.setTitle(按宿舍號查詢信息);f1.setVisible(true);else if(e.getSource()=m3)Form4 f2=new Form4();f2.setTitle(按學院統(tǒng)計);f2.setVisible(true);else if(e.getSource()=m4)Form5 f5=new Form5(); f5.setTitle(按宿舍號統(tǒng)計)

20、;f5.setVisible(true);else if(e.getSource()=m5)Help h1=new Help(幫助信息);h1.setVisible(true); class JavaConnectSQLServer public static Connection getConnection() Connection conn=null; try Class.forName(com.microsoft.jdbc.sqlserver.SQLServerDriver); catch (ClassNotFoundException e) e.printStackTrace(); t

21、ry String connURL=jdbc:microsoft:sqlserver:/localhost:1433;databaseName=data_base; conn=DriverManager.getConnection(connURL,sa,); return conn; catch (SQLException e) e.printStackTrace(); return conn; class Show extends Frame implements ActionListenerLabel b1,b2;Font f;TextField t1; Button button1,bu

22、tton2;Show(String s) super(s);setLayout(null);f=new Font(黑體,Font.BOLD,20);b1=new Label(按學號查詢信息 );b2=new Label(請輸入學號:);t1=new TextField(18);t1.setBounds(280,200,200,25);b1.setBounds(180,100,250,40);b1.setFont(f);b1.setBackground(Color.white);b2.setBounds(100,200,120,25);b2.setBackground(Color.white);

23、t1=new TextField(15);t1.setBounds(250,200,200,25);button1=new Button(確定);button2=new Button(返回);button1.setBounds(200,350,70,25);button2.setBounds(360,350,70,25);setBounds(100,100,600,400);setBackground(Color.white);add(b1);add(b2);add(button1);add(button2);add(t1);button1.addActionListener(this);bu

24、tton2.addActionListener(this);validate();addWindowListener(new WindowAdapter() public void windowClosing(WindowEvent e) setVisible(false); ); public void actionPerformed(ActionEvent e)if(e.getSource()=button1)t1.requestFocusInWindow(); Connection conn=JavaConnectSQLServer.getConnection(); Statement

25、stm=null; try stm = conn.createStatement(); String sql=select * from STUDENT_INFO where snumber=+t1.getText(); ResultSet rs=stm.executeQuery(sql); while(rs.next() System.out.print(學號);System.out.print( ); System.out.print(姓名);System.out.print( ); System.out.print(性別);System.out.print( ); System.out.

26、print(年齡);System.out.print( ); System.out.print(所屬學院);System.out.print( ); System.out.print(寢室樓號);System.out.print( ); System.out.print(寢室號);System.out.print( ); System.out.println();System.out.print(rs.getString(snumber);System.out.print( ); System.out.print(rs.getString(sname); System.out.print(rs

27、.getString(ssex);System.out.print(rs.getString(sage);System.out.print( ); System.out.print(rs.getString(scollege);System.out.print(rs.getString(mlou);System.out.print( ); System.out.print(rs.getString(qnumber); System.out.println();System.out.println(); catch (SQLException k) k.printStackTrace(); el

28、se if(e.getSource()=button2)setVisible(false); class Form3 extends Frame implements ActionListenerLabel b1,b2;Font f;TextField t1;Button button1,button2;Form3()setLayout(null);f=new Font(黑體,Font.BOLD,20);b1=new Label(按宿舍號查詢信息 );b2=new Label(請輸入宿舍號:);b1.setBounds(180,100,250,40);b1.setFont(f);b1.setB

29、ackground(Color.white);b2.setBounds(100,200,120,25);b2.setBackground(Color.white);t1=new TextField(15);t1.setBounds(250,200,200,25);button1=new Button(確定);button2=new Button(返回);button1.setBounds(200,350,70,25);button2.setBounds(360,350,70,25);setBounds(100,100,600,400);setBackground(Color.white);ad

30、d(b1);add(b2);add(button1);add(button2);add(t1);button1.addActionListener(this);button2.addActionListener(this);validate();addWindowListener(new WindowAdapter() public void windowClosing(WindowEvent e) setVisible(false); );public void actionPerformed(ActionEvent e)if(e.getSource()=button1) t1.reques

31、tFocusInWindow(); Connection conn=JavaConnectSQLServer.getConnection(); Statement stm=null; try stm = conn.createStatement(); String sql=select * from STUDENT_INFO where qnumber=+t1.getText(); ResultSet rs=stm.executeQuery(sql); System.out.print(學號);System.out.print( ); System.out.print(姓名);System.o

32、ut.print( ); System.out.print(性別);System.out.print( ); System.out.print(年齡);System.out.print( ); System.out.print(所屬學院);System.out.print( ); System.out.print(寢室樓號);System.out.print( ); System.out.print(寢室號);System.out.print( ); while(rs.next() System.out.println();System.out.print(rs.getString(snumb

33、er);System.out.print( ); System.out.print(rs.getString(sname); System.out.print(rs.getString(ssex);System.out.print(rs.getString(sage);System.out.print( ); System.out.print(rs.getString(scollege); System.out.print(rs.getString(mlou);System.out.print( ); System.out.print(rs.getString(qnumber); System

34、.out.println();System.out.println(); catch (SQLException k) k.printStackTrace(); else if(e.getSource()=button2)setVisible(false); class Form4 extends Frame implements ActionListenerLabel b1,b2;Font f;TextField t1;Button button1,button2;Form4()setLayout(null);f=new Font(黑體,Font.BOLD,20);b1=new Label(

35、按學院統(tǒng)計 );b2=new Label(請輸入學院代號:);b1.setBounds(250,100,250,40);b1.setFont(f);b1.setBackground(Color.white);b2.setBounds(100,200,120,25);b2.setBackground(Color.white);t1=new TextField(15);t1.setBounds(250,200,200,25);button1=new Button(確定);button2=new Button(返回);button1.setBounds(200,350,70,25);button2.

36、setBounds(360,350,70,25);setBounds(100,100,600,400);setBackground(Color.white);add(b1);add(b2);add(button1);add(button2);add(t1);button1.addActionListener(this);button2.addActionListener(this);validate();addWindowListener(new WindowAdapter() public void windowClosing(WindowEvent e) setVisible(false)

37、; );public void actionPerformed(ActionEvent e)if(e.getSource()=button1) int x=0;t1.requestFocusInWindow(); Connection conn=JavaConnectSQLServer.getConnection(); Statement stm=null; try stm = conn.createStatement(); String sql=select * from STUDENT_INFO where scollege=+t1.getText(); ResultSet rs=stm.

38、executeQuery(sql); System.out.print(學號);System.out.print( ); System.out.print(姓名);System.out.print( ); System.out.print(性別);System.out.print( ); System.out.print(年齡);System.out.print( ); System.out.print(所屬學院);System.out.print( ); System.out.print(寢室樓號);System.out.print( ); System.out.print(寢室號);Sys

39、tem.out.print( ); while(rs.next() x+; System.out.println(); System.out.print(rs.getString(snumber);System.out.print( ); System.out.print(rs.getString(sname); System.out.print(rs.getString(ssex); System.out.print(rs.getString(sage);System.out.print( ); if(t1.getText()=1) System.out.print(博雅); System.

40、out.print( ); else if(t1.getText()=2) System.out.print(化生); System.out.print( ); else System.out.print(機械);System.out.print( );System.out.print(rs.getString(mlou);System.out.print( ); System.out.print(rs.getString(qnumber); System.out.println(); System.out.println(該學院有住宿生+x+名); System.out.println();

41、System.out.println(); catch (SQLException k) k.printStackTrace(); else if(e.getSource()=button2)setVisible(false); class Form5 extends Frame implements ActionListenerLabel b1,b2;Font f;TextField t1;Button button1,button2;Form5()setLayout(null);f=new Font(黑體,Font.BOLD,20);b1=new Label(按宿舍號統(tǒng)計 );b2=new Label(請輸入宿舍號:);b1.setBounds(180,100,250,40);b1.setFont(f);b1.setBackground(Color.white);b2.setBounds(100,200,120,25);b2.setBackground(Color.white);t1=new TextField(15);t1.setBounds(250,200,200,25);button1=new Button(確定);button2=new Button(返回);button1.setBounds(200,350,70,25); b

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負責。
  • 6. 下載文件中如有侵權(quán)或不適當內(nèi)容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評論

0/150

提交評論