of 175 /175
Aunur R. Mulyanto SOFTWARE ENGINEERING Book 3 Vocational Education Directorate Technical and Vocational Education Directorate General of Management Education Basic and Middle Department of National Education Copy Right@Department of National Education All right reserve

Rekayasa perangkat lunak(Jilid3)

Embed Size (px)

Text of Rekayasa perangkat lunak(Jilid3)

Page 1: Rekayasa perangkat lunak(Jilid3)

Aunur R. Mulyanto


Book 3

Vocational Education

Directorate Technical and Vocational Education Directorate General of Management Education Basic and MiddleDepartment of National EducationCopy Right@Department of National Education All right reserve

Page 2: Rekayasa perangkat lunak(Jilid3)



For Vocational Education

Author : Aunur R. Mulyanto Cover Design : Team Book Size : 17,6 x 25 cm

MUL MULYANTO,Aunur R. Software Engineering Book3 For SMK / by Aunur

R. Mulyanto ---- Jakarta : Directorate Technical and Vocational Education Directorate General for Basic and Middle Education Department of National Education, 2008. xii. 163 pages Libraries : A1-A2 Glosarium : B1-B6 ISBN : 978-979-060-007-2 ISBN : 978-979-060-008-9

Published by: Directorate Technical and Vocational Education Directorate General Primary and Secondary EducationDepartment of National Education 2008

Page 3: Rekayasa perangkat lunak(Jilid3)

iii Softwae Engineering

Directorate Technical Vocational Education

Page 4: Rekayasa perangkat lunak(Jilid3)


We thank to Allah SWT, blessing and gift of His mercy, the Government, in this case, the Directorate of Development of Vocational High School of Directorate General of Primary and Secondary Education Management, Ministry of Education, has conducted the activities of the book trade as a form of purchase of copyright books text for students learning vocational SMK. Because textbooks vocational very difficult to get in on the market. Text book lesson this has been through the process of assessment by the National Education Standards as a text book lesson to SMK and have been declared eligible to be used in the feasibility of the learning process through the Ministry of National Education Regulation No. 45 Year 2008 on 15 August 2008.

We delivered the award at a high level to all the writers who have been well switch copyright works to the Ministry of National Education to be used widely by teachers and students SMK. Text book lessons that have been transferred the copyright to the Ministry of National Education is, can be downloaded , duplicated, printed, media transfer, or photocopy by the community. But for the multiplication of commercial sales price must meet conditions set by the Government. With the soft copy of this show will be easier for the public especially teachers and students of vocational school (SMK) in Indonesia as well as abroad to access and utilize as a reference.

We hope all parties can support this policy. To the students good luck in your study and hopefully can use this book as well as possible. We realize that this book still needs to be improved quality. Therefore, suggestions and criticisms are we expected.

Jakarta, 17 Agustus 2008

Director of Technical and Vocational Education

Page 5: Rekayasa perangkat lunak(Jilid3)

v Softwae Engineering

Directorate Technical Vocational Education

Page 6: Rekayasa perangkat lunak(Jilid3)

vi Softwae Engineering


With all humility, we give thanks to Allah SWT. Because only with patronage, blessing and gift of His mercy , then this book can be completed.

Book entitled 'Software Engineering' is organized to meet the needs handbook for students Vocational Education. Especially on the program expertise Software Engineering. This book includes a description refers to the standard of competence and basic competencies for Software Engineering students from SMK class X, XI to class XII.

Each chapter contains a theory must be understood correctly by students and accompanied by examples of problems that are relevant to the theory. In addition there is also a matter that is based on the concept and discussed the theory test as a tool to measure the ability of students in the control of these materials.

In developing this book, the author seeks to be the material that is presented in accordance with the needs of competency to be achieved. Therefore, apart from the result of thought and experience as writers and practitioners of Software Engineering, which developed the material with other appropriate reference

In this moment I wish to thank to all parties that support this book can be published. Hopefully this book can be useful for students in developing capabilities. The author realized that this book still needs to be developed continuously, so that the suggestions from various parties, this book is useful.

The Author,

Directorate Technical Vocational Education

Page 7: Rekayasa perangkat lunak(Jilid3)

vii Softwae Engineering

Table of ContentsFOREWORD......................................................................................................ivEDITORIAL........................................................................................................viHOW TO USE THIS BOOK..............................................................................ixCHAPTER 11. DATABASE APPLICATION OF MICROSOFT ACCESS....1

11.1. DATABASE APPLICATION MENU ................................................211.2. TABLE.................................................................................................9

11.2.1 Field and Data Type Definition .......................................................911.2.2. Data Entry To The Table...............................................................13

11.3. QUERY ................................................................................................1511.3.1. Relations between tables ..............................................................1511.3.2. Making Query ..............................................................................17

11.4. FORM ..................................................................................................2711.4.1. Create Form .................................................................................2811.4.2. Modification of the Form .............................................................34

11.5. REPORT ..............................................................................................4011.6. SUMMARY ........................................................................................4911.7. EXERCISES ........................................................................................50

CHAPTER 12 SQL BASED DATABASE........................................................5112.1. An Overview of Structured Query Language (SQL)............................52

12.1.1. Data Definition Language (DDL) ................................................5212.1.2. Data Manipulation Language (DML)...........................................52

12.2. PREPARING SOFTWARE IN SQL BASE .....................................5312.2.1. Operation Requirements...............................................................5312.2.2. Operation of SQL based Database software ................................54

12.3. MAIN MENU / FEATURES.............................................................5612.4 . CREATION AND DATA ENTRY IN TABLE....................................58

12.4.1. Database Creation.........................................................................5812.4.2. Table Creation..............................................................................5912.4.3. Fill in Data into Table...................................................................60

12.5. ABLE VIEW AND OPERATION........................................................6112.5.1. Relation Between Tables ..............................................................6112.5.2. View Creation...............................................................................62

12.6. T-SQL USAGE.....................................................................................6812.6.1. Defining Table using T-SQL ........................................................6912.6.2. Fill in, Change and Remove Table contents by SQL ...................72

Directorate Technical Vocational Education

Page 8: Rekayasa perangkat lunak(Jilid3)

viii Softwae Engineering

12.6.3. Search and View Data by SQL ....................................................7412.7. FUNCTION, PROCEDURE DAN TRIGGER .................................78

12.7.1. Function .......................................................................................7812.7.2. Procedure and Stored Procedure ..................................................8112.7.3. Trigger ..........................................................................................83

12.8. ADMINISTRASION SQL SERVER....................................................8312.8.1. Security and Authentication..........................................................8312.8.2. Permissions ..................................................................................8512.8.2. Permissions ..................................................................................85

12.9. SUMMARY ........................................................................................8612.10. EXERCISE.........................................................................................87

CHAPTER 13 DESAIN WEB STATIS DAN HTML ......................................8813.1. BASIC CONCEPT AND WEB TECHNOLOGY ..............................89

13.1.1 Web Technology Standard.............................................................8913.1.2. Static and Dynamic Web. .............................................................90

13.2. PREPARATION TO CREATE A WEB ..............................................9113.2.2. The Hardware ...............................................................................9113.2.3. The Software.................................................................................91

13.3. CREATION AND EVALUATION OF WEB PAGES .......................9713.4. HTML ................................................................................................100

13.4.1. Understanding the HTML ..........................................................10013.4.2. General File Structure in HTML Language................................10313.4.3. Document Format ......................................................................10713.4.4. Adding Objects ...........................................................................11213.4.5. Table............................................................................................11413.4.6. Link between Documents............................................................118

13.5. SUMMARY .......................................................................................11913.6. EXERCISE.........................................................................................119

CHAPTER 14 DYNAMIC JSP BASED..........................................................12114.1 THE BASIC OF DYNAMIC WEB ....................................................12214.2 SUMMARY.........................................................................................14914.3 EXERCISE .........................................................................................149

REFERENCES.................................................................................................151APPENDIX 1 GLOSARY..............................................................................153APPENDIX 2 SITE LIST................................................................................159APPENDIX 3 FUNCTIONS BUILD-IN ON VISUAL BASE.......................161

Directorate Technical Vocational Education

Page 9: Rekayasa perangkat lunak(Jilid3)

ix Softwae Engineering


A. Global Description

This book is given the title "Software Engineering", together with one of the program expertise in the Vocational School (SMK). However, the actual contents of this book is not specifically discuss on Software Engineering. From the perspective of Computer Science field of five sub-areas covered in this book, the sub-field of Engineering Software, Operating System, Algorithm and Data Structure, Programming Languages and Database. This curriculum tailored to the level of expertise SMK Program for Software Engineering.

Main subject of Engineering Software in general, describe the basics of Software Engineering, and solving problems, and methods of software development. The discussion about the sub-field of Operating System contains a computer system, the system operating and working in the computer network. The scope of the material basic algorithms include algorithms and advance algorithms. Sub field Programming Languages take a big portion, including GUI programming with VB & VB.Net, Java programming, C + + programming, Programming of object-oriented and web-based. Sub-sector which is the last part of this book is a data base with the scope of the system databases, conceptual modeling, relational database, Microsoft Access and SQL.

B. Competency Map

In general, this book refers to the Standard and Competence Basic Competency (SKKD) for Vocational School (SMK) as follows :

1. Using a basic level of programming algorithm 2. Using advanced programming algorithm 3. Operate the database application 4. Create an application-based Microsoft Access 5. Mastering the basic techniques electronics 6. Mastering the digital electronics technology 7. Create file with HTML according to specifications 8. Applying the basics of creating a basic level of static web 9. Make the application using VB and VB.NET 10. Make the software application package 11. Doing programming data description (Structured-SQL Query Language) basic

level 12. Operates programming data description language (SQL) advanced

Directorate Technical Vocational Education

Page 10: Rekayasa perangkat lunak(Jilid3)

x Softwae Engineering

13. Create a web page dynamic basic levels 14. Create a web page more dynamic level 15. Create a web application program using JSP Software Engineering 16. Make the application database using XML 17. Make a database program using Microsoft (SQL Server) 18. Make a database program using PL / SQL (Oracle) 19. Make the application using C + + 20. Explaining the system peripherals 21. Make the program in object-oriented programming language 22. Make the application using Java 23. Operate the computer operating system and text-based GUI

In this book, chapters not compiled based on SKKD, but the materials are developed based on the sequence of basic subject. So that in some chapters contain a mix of several standards of competence. Or a basic competency may not be on the competency standards groups such as SKKD on the list, but is on the other sub-chapters.

SKKD suitability and content of the chapter can be seen in the table below :

Competency Code Competency Relation

ELKA-MR.UM.001.A Mastering the basic techniques electronics 3

ELKA.MR.UM.004.A Mastering the digital electronics technology and Computer


TIK.PR02.001.01 Using a basic level of programming algorithm 5

TIK.PR02.002.01 Using advanced programming algorithm 6

HDW.OPR.103.(1).A Operate the computer operating system and text-based


HDW.OPR.104.(1).A Operate the computer operating system based GUI


TIK.PR02.020.01 Operate the database application 10 and 11

TIK.PR08.004.01 Create an application-based Microsoft Access 11

TIK.PR08.024.01 Create file with HTML according to specifications 13

TIK.PR08.027.01 Applying the basics of creating a basic level of static web


TIK.PR08.003.01 Make the application using VB and VB.NET 7

TIK.PR02.016.01 Make the software application package 7

TIK.PR03.001.01 Doing programming data description (Structured - 12

Directorate Technical Vocational Education

Page 11: Rekayasa perangkat lunak(Jilid3)

xi Softwae Engineering

SQL Query Language) basic level

TIK.PR03.002.01 Operates programming data description language (SQL) advanced


TIK.PR04.002.01 Create a web page dynamic basic levels 13

TIK.PR04.003.01 Create a web page dynamic advance levels 13

Competency Code Competency Relation

TIK.PR02.009.01 Operate the program in object-oriented programming language


TIK.PR08.012.01 Make application program using Java 8

TIK.PR08.001.01 Make application program using C++ 9

TIK.PR06.003.01 Describe Peripheral system 3

TIK.PR08.005.01 Make database using PL/SQL 10 and 12

TIK.PR08.006.01 Make database program using SQL server 12

TIK.PR08.008.01 Make JSP based we application web program 14

C. How to use this book

This book is specifically aimed at students and teachers for the vocational school (SMK) expertise in RPL. However, this book is also open for general readers who are interested in the RPL, Algorithm and Programming, Database and the Internet. For students, this book can be a handbook, because this book is to provide learning materials that are complete enough for the subjects for three years at the school. Some parts of this book may need books to help enrich more insight and capacity building. Whereas for teachers, this book can be used as reference books to prepare teaching modules for the students. This book is structured in such a way so that students can independently learn and encourage to try. Therefore, in this book, many will be found either in the form of illustration image, the scheme and program listings. This is so that students can easily understand the explanation or the application of a particular concept. The chapter will be ended with exercise of the subject.

Directorate Technical Vocational Education

Page 12: Rekayasa perangkat lunak(Jilid3)

xii Softwae Engineering

Directorate Technical Vocational Education

Page 13: Rekayasa perangkat lunak(Jilid3)

1 Sftware Engineering


Figure 11.1. Microsoft Access 2007.

The above Figure shows the starting windows of the newest Microsoft Access version 2007. The software is part of Microsoft Office Suite that rarely used but available in Microsoft Office package and is very useful.

This chapter discuss about two standard of competences. First is operating an application database and, second, making the application based on Microsoft Access. The first standard consists of three (3) basic competences, namely, explaining the application menu of the database, making table and creating view or query. And the second standard consists of four (4) basic competences, namely, explaining Database Management System, describing the Data Definition Language, applying query and reporting. Database Management System is explained in the Chapter 10, and Definition Language Data is in the Chapter 12. It is important to review the principle of problem solving, operating system, and the foundation of the database in the previous chapters.

Directorate Technical Vocational Education

Page 14: Rekayasa perangkat lunak(Jilid3)

2 Sftware Engineering


After reading this chapter, the readers are hoped to be able to,

● Explain the general menu of database application.● Create table.● Create and apply View / Query.● Create Form● Create Report

11.1. DATABASE APPLICATION MENU As mentioned in the previous chapters, Microsoft Office 2007 is Microsoft's DBMS. The latest version of Microsoft Access is version 2007 which is part of Microsoft Office 2007. The default data format for the recent version is different from the previous version. The previous file extension is .mdb, whereas the current extension is .accdb. The recent version database file may not be read by the previous version. However, the recent version may read the database file from the previous version.

To start the Microsoft Access, click Start on Windows select Programs then Microsoft Access. The first Windows of Microsoft Access is shown in Figure 11,2. Microsoft Access has several options in creating a database as shown in Figure 11.2. The mostly use database option is Blank database. If we click this section, then a request window to define the database will appear as shown in Figure 11.3. Make sure that the name and the location of the storage is confirm.

Directorate Technical Vocational Education

Page 15: Rekayasa perangkat lunak(Jilid3)

3 Sftware Engineering

Figure 11.2. First showing of the Microsoft Access.

Figure 11.3. The specific name and location of the database.

Directorate Technical Vocational Education

Page 16: Rekayasa perangkat lunak(Jilid3)

4 Sftware Engineering

When we press the Create button meaning we create a database. However, there is no table or data in it as shown in Figure 11.4. We can see the name file of the database is latihan 01 and the database format files uses Access 2000. In the Figure is shown the database objects.

Figure 11.4. Parts of a Database of the Microsoft Access.

There are six (6) important Access objects in this DBMS, namely,

● Table. It is the place where we keep the data. All the tables in Access follow the database relational rules with lines and column. Each database may contain more than one table.

● Queries. Queries feature is provided to choose the data to be shown. While queries of the Access is available both GUI and SQL language.

● Forms. Form feature is provided to create Interesting appearance of the database. Both while editing as well as output the data on the screen.

● Reports. This feature is provided to create to make printing layout for printer.● Macros. Macro feature is usually used to keep an automatic specific

Directorate Technical Vocational Education

Page 17: Rekayasa perangkat lunak(Jilid3)

5 Sftware Engineering

order related to the created database. Programming ability is needed to be able to use this facility.

● Modules. This feature is more elaborated than macros and provides many programming aspects in Microsoft Access.

In addition to the main objects, Microsoft Access also provides a set of tools to support and make easy in using the database and its applications. The following is some figures of the the tool bar in the Microsoft Access as well as its usage.

Figure 11.5. Tool bar on menu Create.

Figure 11.6. Tool bar on menu External Data.

Directorate Technical Vocational Education

Page 18: Rekayasa perangkat lunak(Jilid3)

6 Sftware Engineering

Figure 11.7. Tool bar on menu Database Tool.

In this book, we will observe four (4) objects, namely, table, query, form and report. However, prior to describe how to use these objects in the Microsoft Access, we will briefly discuss a database case sample. It is Database of the Book Sale. In this case, each book buyer will purchase a book and will pay suitable amount of money for the book. The buyer's data will be recorded. In addition, each data, both summary and detailed items are also recorded. The data contains the buyer who do the order, the total purchase order and the date of order. Whereas the item data contains the ordered book data and the number of each order.

For the above case, we make ER Diagram, the first step is to identify of the candidate of involved entities. From the text, we identify there is minimum of four (4) entities candidate, they are the buyer, the book, the order and the item ordering. Whereas the identified relations are as follows.

● the buyer do the ordering● each order contain items● each item contain the list of books order.

Attributes for each entity candidate describes as follows.● The buyer entity is attributed with id_pembeli, nama, alamat, and telepone. ● The book entity is attributed with ISBN, pengarang, and judul ● The order entity is attributed with id_pesanan, jumlah pembelian, tanggal

pembelian.● The purchase entity is attributed with total books order.

After all information is completed then we may draw the ER Diagram for that case as shown in Figure 11.8.

Directorate Technical Vocational Education

Page 19: Rekayasa perangkat lunak(Jilid3)

7 Sftware Engineering

Figure 11.8. ER Diagram for the case of the book sale Database

Base on the ER Diagram, we may decide the needed tables for book sale database. There are four (4) tables: pembeli, buku, pesanan, and item pesanan. To accommodate relations in ER Diagram, then we use attributes to create the relationship. Table 11.1 shows the attribute in the book sales database. Table 11.1. Table and attribute in book sale database.

Table Attribute Comments

Customer Customer ID Customer ID is the primary key due to its uniqueness.




Book ISBN ISBN is the primary key due to its uniqueness




Directorate Technical Vocational Education

Page 20: Rekayasa perangkat lunak(Jilid3)

8 Sftware Engineering

Order Order ID Order ID is the primary key due to its uniqueness

Customer ID Purchase ID is the foreign key to link the buyer to the order. This is to relate the buyer who do the order.

Amount of Purchase

Date of Purchase

Order Item Order ID Order ID and isbn are both the primary key.

IDBN Order ID is the foreign key to relate order to Order item. While IDBN relates to the book in the Order Item


Table 11.1 should be completed with data type and constraint / domain such as in Table 11.2. This is to make it easer to create table in DBMS. While we check whether tables are in normal form or not, then we will see all tables in the third normal form (3NF).

Directorate Technical Vocational Education

Page 21: Rekayasa perangkat lunak(Jilid3)

9 Sftware Engineering

Table 11.2. Table, attribute, data type, and constraint / domain in the book sale database.

Table Attribute Data Type Constraint

Customer Customer ID Integer Not Null

Name Char/Text (30)

Address Char/Text (60)

Telephone Char/Text (15)

BOOK ISBN Char/Text (15) Not Null

Author Char/Text (30)

Title Char/Text (50)

Price Real/Float (10,2)

Order Order ID Integer Not Null

Customer ID Integer Not Null

Amount of Purchase Real/Float(10,2)

Date of Purchase Date

Order Item Order ID Integer Not Null

IDBN Char/Text (30) Not Null

Quantity Integer Not Null dan >0

11.2. TABLE When you finish create the database file, please see Figures 11.3 and 11.4, we have a database file but empty as we have not create tables in the database. As explain in Chapter 10, the table contains column and row. Column is called field while row is called record in Microsoft Access.

11.2.1 Field and Data Type Definition

The first step in creating the table is defining the field then fill up data rows. Steps are as follow:

1. In the Database window click the Table (Figure 11.9).2. Double click to Create table in Design View (Figure 11.9). After that, the

window appears to define fields as we need (Figure 11.9)

Directorate Technical Vocational Education

Page 22: Rekayasa perangkat lunak(Jilid3)

10 Sftware Engineering

Figure 11.9. The First Step in Table Creation

3. We may begin to create the needed fields. For example, we will put the fields for table Pembeli as defined in Table 11.2 Please examine Figure 11.10.

Directorate Technical Vocational Education

Page 23: Rekayasa perangkat lunak(Jilid3)

11 Sftware Engineering

Figure 11.10. Field Definition and the Type of Data, Constraint and Domain.

Microsoft Access provides good facilities to define fields in a table. Figure 11.10 shows the process of defining field. The upper part is to determine the name of the field, the data type and information. Whereas the lower side is the place to define the data width, the format, the domain or constraint from a data type. In this figure, we can see that the field nama is definite as text data, with the field size is 30 (see the picture underside).

4. After all field for table pembeli is completely defined, then we must determine which field should be the primary key. As described earlier, id_pembeli is the primary key. Select id_pembeli, then click key simbol, as shown in Figure 11.11, in the Microsoft Access tool bar.

Directorate Technical Vocational Education

Page 24: Rekayasa perangkat lunak(Jilid3)

12 Sftware Engineering

Figure 11.11. Toolbar Microsoft Access.

5. We can save the table and give the name by pressing the diskette button as shown in Figure 11.11. Then we can close the Design View window. In the same way, other tables, such as, table buku, table pesanan, and table item_pesanan, may be defined. These pictures show the results of a complete definition of the tables.

Figure 11.12. Structure of table pembeli

Figure 11.13. Structure of table buku

Directorate Technical Vocational Education

Page 25: Rekayasa perangkat lunak(Jilid3)

13 Sftware Engineering

Figure 11.14. Structure of table pesanan

Figure 11.15. Structure of table item_pesanan

11.2.2. Data Entry To The Table The newly created tables is still empty. It has only the structures. It is very easy to fill in the data, just double click the table's name and fill the data in. After the window opened as shown in Figure 11.16, we could fill in the data. The steps to fill in the data is as same as if we work with Microsoft Excel or other spreadsheet software. We can save the results of the data by pressing the diskette button in the tool bar.

Figure 11.16. Result of the data in table pembeli.

Figure 11.16 shows the contents of the data of the table pembeli. Using the same way, we can fill the data in other tables. Examine the results of the data filling in below Figures.

Directorate Technical Vocational Education

Page 26: Rekayasa perangkat lunak(Jilid3)

14 Sftware Engineering

Figure 11.17. Result of the fill data in table buku.

Figure 11.18. Result of the fill data in table pesanan

Figure 11.19. Result of the fill data in table item_pesanan

Directorate Technical Vocational Education

Page 27: Rekayasa perangkat lunak(Jilid3)

15 Sftware Engineering

11.3. QUERY In this section, we will apply query theories that we have explained, Query is basically “data request”. With query, we can show the data from one or more tables, or do data calculation from the table. It would be better to understand table relations so that make it easier to study on query.

11.3.1. Relations between tables

In Figure 11.8, we define relations between the entities in ER Diagram. The Figure is the base to create relation between tables. To create relation between tables, select menu Tools then relationship so that Windows as Figure 11.20 is shown. At the window relationships – do right click – selection menu will be shown and select Show Table. After window similar to Figure 11.21 is shown, we can decide which table to make the relationships.

Figure 11.20. Relationships Windows. Figure 11.21. Show Table Windows

In Figure 11.21, select table to create the relationship then click Add button. After completing the selection process click Close button. In our case, the four (4) tables are directly or indirectly connected. We chose all the tables to make the relationship. Figure 11.22 shows the result of the table selection in the Relationships window. In the Figure is shown the structure of each tables, not the content. Column name is boldly printed is the primary key. We can manage table position by drag & drop.

Directorate Technical Vocational Education

Page 28: Rekayasa perangkat lunak(Jilid3)

16 Sftware Engineering

Figure 11.22. Tables Relationship

To make the relations between the table, we can chose primary key on a table then drag the mouse to the key with the same name in other table (foreign key to the other table). For example, in table pembeli, with primary key – id_pembeli and in table pesanan, id_pembeli is foreign key. Click id_pembeli in table pembeli then drag the mouse towards id_pembeli in table pesanan. If the procedure is correctly performed, the windows as shown in Figure 11.23 will be shown. Please click on the Enforce Referential Integrity and also click on Create button. We can do the same procedure with other relations. So that the Relationships window will be similar to Figure 11.24.

Figure 11.23. Windows to Edit Relationships

Directorate Technical Vocational Education

Page 29: Rekayasa perangkat lunak(Jilid3)

17 Sftware Engineering

Figure 11.24. Relations to All Tables

Figure 11.24 shows the relations between the tables and can be compared with ER Diagram in Figure 11.8. In the table relationship, we may decide cardinality between tables. Please note the line connecting table pembeli with table pesanan. At the table pembeli end it is marked 1, while at the table pesanan end, it its marked by ∞. It means one- to-many relations between the table pembeli and table pesanan. Similarly with the relation to other tables.

11.3.2. Making Query Microsoft Access provides query facility to make the user easier. As it is GUI based, the procedure is fairly simple. Here are some samples in making query in Microsoft Access.

● Query in one table

Query in one table only involves in one table. For example we will do query to the table buku. The procedure is as follows:

1. At the Database window select Query then click twice on Create Query

In Design View. The screen as shown in Figure 11.25 will be shown.

Directorate Technical Vocational Education

Page 30: Rekayasa perangkat lunak(Jilid3)

18 Sftware Engineering

Select table buku on window Show Table, click Add then Close. The Show Table window will close and we begin to do query.

Figure 11.25. Windows query at mode design view

2. In Query window as shown in Figure 11.25 underside, there are several important matters and useful in query, namely,

Field : Field Name to showTable : Table name of the Field Sort : Sort the Query resultsShow : Manage Field to be shown or not.Criteria: the Condition of the data to be shown.

3. Example, the first query how to show all the data, such as,

Show, all data in the table buku.

To show all data in table buku, on the Filed, drag down the arrow and click on buku. * (see Figure 11.26). To execute query, we can select the Query menu then click Run, or directly click “!” button in Toolbar. The query results can be seen in Figure 11.26. Keep query by any name, e.g. query_of_all_book_data, then close the Query window.

Directorate Technical Vocational Education

Page 31: Rekayasa perangkat lunak(Jilid3)

19 Sftware Engineering

Figure 11.26. Procedure and result Query of table book.

4. Example: the second query to select certain columns to be displayed, such as,

Show the name of authors and the book title.

The Query does not show all the data but only column of pengarang and judul. Figure 11.27 shows how to do the query. The table buku is selecte from window Show Table, then in Query window, in the Field section select Field pengarang and judul. The query results will be all the author and the title of the book.

Directorate Technical Vocational Education

Page 32: Rekayasa perangkat lunak(Jilid3)

20 Sftware Engineering

Figure 11.27. Query of the writers and the titles

5. Example: The third query, how to show a selected / specific data, such as,

Show all the titles of the book and its price, and sort from the expensive to cheapest.

This query is not to show all data, but only he title of the book and its price. The print out must be sorted. Figure 11.28 shows how to do the query. Table buku is selected from window Show Table, then in window Query, in the Field section selects field judul and harga. In the section Sort, in column harga, use option Descending to short from the high to low price. The result of the query is the list of the most expensive books to cheapest. Compare the list sequence to the query result in Figure 11.26.

Directorate Technical Vocational Education

Page 33: Rekayasa perangkat lunak(Jilid3)

21 Sftware Engineering

Figure 11.28. Query for price sorted book titles

Example: The fourth query, how to select certain row to be printed, such as,

Collect all books written by Harry Redknapp.

This query is using the data of field judul buku and pengarang. However, not all book title will be used, only those written by 'Harry Redknapp'. Figure 11.28 shows how to do the query. Table buku is selected from window Show Table, then in window Query, in Field section selects pengarang and judul. In the criteria section put in the criteria, namely, = ‘Harry Redknapp’. Results of the execution query is the lists books written by ‘Harry Redknapp’.

Directorate Technical Vocational Education

Page 34: Rekayasa perangkat lunak(Jilid3)

22 Sftware Engineering

Figure 11.29. Query with some criteria

7. Example: the fifth query, how to use the operator in the criteria.

Collect all the titles of the books with writes are Harry Redknapp and Arsene Wenger

Similar to no 6, this query only relates to field judul and pengarang. However, not all title will be used only those written by ‘Harry Redknapp and Arsene Wenger’. Figure 11.30 shows how to do the query. Similarly to no 6, only at the criteria we put = ‘Harry Redknapp’ and ‘Arsene Wenger’. Results of the execution is unsatisfactory, Why? Because there is no book written together by ‘Harry Redknapp’ and ‘Arsene Wenger’. What is the result, if we substitute and with or? Examine Figure 11.31, there are three (3) appropriate records.

Directorate Technical Vocational Education

Page 35: Rekayasa perangkat lunak(Jilid3)

23 Sftware Engineering

Figure 11.30. Query with and operator.

Figure 11.31. Query with or operator.

Directorate Technical Vocational Education

Page 36: Rekayasa perangkat lunak(Jilid3)

24 Sftware Engineering

● Query for more than one table

In query for more than one table, relations between tables is becoming very important. These relations will impact on the query results. Procedure to make the query is the same as query in one table, but the table at the window Show Table may be more than one, depending on the requirement. Here is several samples of query with more than one tables.

1. Example, the first query involves two tables, such as,

show name and address of the buyers for purchase more than 100000.

In this query, we need table pembeli as column nama and alamat of the buyer is in table pembeli. We also need table pesanan as column jumlah pembelian is in this table. From the relation between tables shown in Figure 11.23, we know that there is a relation between table pembelian and table pesanan with cardinality one-to-many. Procedure to make a query is as follows,

In window Database selects Query and double click on Create Query In Design View. Window Show Table will pop-up. In window of Show Table selects table pembeli and pesanan as shown in Figure 11.32. Click Add then close. Window Show Table closes then we can make query.

Figure 11.32. Selection Table for query from two tables

Directorate Technical Vocational Education

Page 37: Rekayasa perangkat lunak(Jilid3)

25 Sftware Engineering

As we select table pembeli and pesanan as shown in Figure 11.33, Microsoft Access will automatically show the line of the relations between these two tables. If we have not make any relations, the line of the relations will not be shown. Figure 11.33 shows the Field for column nama and alamat in table pembeli. While column jumlah_pembelian is in table pesanan. In addition, in column jumlah_pembelian, we add criteria, namely, must be more than 100000. The query execution shows that there are two buyers with total purchases more than 100000.

Figure 11.33. Two Tables query

2. Example in the second query involves three tables.

Show the book title and its writers bought on 22 July 2007 or 25 July 2007.

In this query, we need table buku as column judul and pengarang is in table buku. While column tanggal_pembelian is in table pesanan. However from Figure 11.24, it is shown that there is no direct relation between table pesanan and table buku. However, table pesanan has a direct relation with table item_pesanan, and table item_pesanan has a direct relation with table buku. All relations are cardinally one-to- many. The query is as follow.

Directorate Technical Vocational Education

Page 38: Rekayasa perangkat lunak(Jilid3)

26 Sftware Engineering

Select table buku, table item_pesanan and table pesanan in windows Show Table. Click Add then Close. Figure 11.34 shows the relation between the three (3) tables. The query results shows three (3) records as shown in the Figure.

Figure 11.34. Three tables query.

3. Example, the third query involves all tables in the book sale database, such as,

Show the name and address of buyers who buy the Theory of Modern Football book.

In this query, we need table pembeli as column nama and alamat is in table pembeli. We also need table buku, as column judul is in table buku. From the table relation in Figure 11.24, there is no direct relation between table pembeli and table buku, and must through table pesanan and item_pesanan. Thus, we need four (4) tables to do the query. Figure 11.35 shows how makes the query and produce the

Directorate Technical Vocational Education

Page 39: Rekayasa perangkat lunak(Jilid3)

27 Sftware Engineering

three (3) records.

Figure 11.35. Four tables query.

11.4. FORM Form is one of the database objects in Microsoft Access and use for data input / output. For a beginner, to input data as Figure 11.16 up to 11.19 is quite complicated.. It would be better to use form. In Microsoft Access, there are three (3) models of form, namely, data entry form (Figure 11.36 no. 1), switchboard form (no. 2) and custom dialog form (no.3). There are two ways to produce form in Microsoft Access; namely, using Wizard and Design View. Wizard is the easiest as Microsoft Access help automatically creates the form. While in Design View, we may manually design the form. We may also modify the result from the Wizard using Design View.

Directorate Technical Vocational Education

Page 40: Rekayasa perangkat lunak(Jilid3)

28 Sftware Engineering

Figure 11.36. Form types.

11.4.1. Create Form

In this section, we will create form using the Wizard. The first form to be made is to input data for table Pembeli.

1. At Database window, click object Form, then double click on Create form by using Wizard. The Form Wizard window will open as shown in Figure 11.37.

Figure 11.37. Open Form Wizard Window

Directorate Technical Vocational Education

Page 41: Rekayasa perangkat lunak(Jilid3)

29 Sftware Engineering

2. In Form Wizard window, click on combo box Table/ Queries and select table pembeli as shown in Figure 11.38, and click on button >> so all field in the Available Fields moves to Selected Fields as shown in Figure 11.39. Then, click Next to pop-up the window and select the model view form as in Figure 11.40.

Figure 11.38. Table Selection for Form

Directorate Technical Vocational Education

Page 42: Rekayasa perangkat lunak(Jilid3)

30 Sftware Engineering

Figure 11.39. Selection Field for form.

Directorate Technical Vocational Education

Page 43: Rekayasa perangkat lunak(Jilid3)

31 Sftware Engineering

Figure 11.40. Window for The Model View Form.

3. In Figure 11.40, there are several model view form options. We will try to create using Columnar model. However, the reader may be freely try any available models. Click on Next button to select the style as shown in Figure 11.41. In this windows, we may select our best suited form and completed by clicking Next to pop-up Title form windows. Fill in the title form in the available text box as shown in Figure 11.42.

Directorate Technical Vocational Education

Page 44: Rekayasa perangkat lunak(Jilid3)

32 Sftware Engineering

Figure 11.41. The window to select style form.

Figure 11.42. The window to set the title form.

Directorate Technical Vocational Education

Page 45: Rekayasa perangkat lunak(Jilid3)

33 Sftware Engineering

4. Click on Finish button as shown in Figure 11.42. Buyer's form is completed as shown in Figure 11.43. The important things from this form is the navigation button and the new record button. The function of The navigation button is print and sort the data based on id_pembeli. If the add button is clicked, all text in the Text box will emptied and new data may be filled up.

Figure 11.43. The Buyer's Form

Using the same way, we can create the other forms. For example the following is the book form.

Directorate Technical Vocational Education

Page 46: Rekayasa perangkat lunak(Jilid3)

34 Sftware Engineering

Figure 11.44. Book's Form.

11.4.2. Modification of the Form Create Form with wizard mode gives two benefits, namely, easiness and faster in creating one. On the other hand, it has a disadvantage as all formats are automatically set. A good example as shown in Figure 11.43 and 11.44, the name of the Fields on the form is made the same as the Field on the tables. Fortunately, Microsoft Access provides facility to modify the form as follow.

1. In Database window, select Form. Then do right click on the name of the form to be modified. Select Design View in pop-up menu to show the form to be modified is shown as in Figure 11.45.

Figure 11.45. Window Buyer's Form in Mode Design View.

Directorate Technical Vocational Education

Page 47: Rekayasa perangkat lunak(Jilid3)

35 Sftware Engineering

2. In Figure 11.45, we will modify the Buyer's Form. Prior to any modification, we need to know the element / section of the form. Figure 11.56 shows the main section of the form, namely, Form Header, Detail and Form Footer. Form Header contains the title and the specific logo. The Detail section is the main section, as all the Field is here. The Form Footer is optional. Form Footer contains information, such as, the creator, the data entry operator, etc.

Figure 11.46. Section of the Form.

3. Microsoft Access uses the same controls as the GUI base programming language as described in Chapter 13. In the form, we will find control Label, Text Box, Combo Box, Command Button etc.

4. The first modification is to fix the view of the name fields. Click on the Label to be fixed. Then change or substitute with new name. After all completed, the preview of buyer's form will be show as Figure 11.47. Examine the label Fields in Figure 11.45 and Figure 11.47.

Directorate Technical Vocational Education

Page 48: Rekayasa perangkat lunak(Jilid3)

36 Sftware Engineering

Figure 11.47. Change the Label Fields in Buyer's Form

5. The next modification is to add switches to make easy for the user in filling up the data. To do this we must arrange form as Figure 11.48. Then we add switch by clicking the icon Command Button at Toolbar to place it in the Form. The Command Bottom Wizards will be poped-up as shown in Figure 11.49. In Categories select Record Operations and in Actions select Add New Record. Click Next to continue. The next window as shown in Figure 11.50 select Text and type Tambah then click Next. The following window as shown in Figure 11.51, type the name to this command button, e.g., cmdTambah, then click Finish.

Directorate Technical Vocational Education

Page 49: Rekayasa perangkat lunak(Jilid3)

37 Sftware Engineering

Figure 11.48. The modification preview form.

Figure 11.49. Define a Command Button action

Directorate Technical Vocational Education

Page 50: Rekayasa perangkat lunak(Jilid3)

38 Sftware Engineering

Figure 11.50. Define a Command Button text

Figure 11.51. Define a Command Button Name

Directorate Technical Vocational Education

Page 51: Rekayasa perangkat lunak(Jilid3)

39 Sftware Engineering

6. We add button to delete data. We can do this in the same way as the above procedure and use the Command Bottom Wizards window, in the categories select Record Operations and select Actions to Delete Record as in Figure 11.52. Set text and the name of the appropriate command button.

Figure 11.52. Define a Command Button name

7. The final view of the modified form is shown in Figure 11.53.

Directorate Technical Vocational Education

Page 52: Rekayasa perangkat lunak(Jilid3)

40 Sftware Engineering

Figure 11.53. Modified result of Buyer's Form

We may add more switches or controls using a fairly the same method.

11.5. REPORT Report, as same as form, can use to show the data processing result into printer ready information. We can always print directly from the database table, however, the printer result may not be satisfactory. The best way to print a report is using the report model provided by Report facilities. There are two (2 ) ways in making Report, namely, manual or using wizards. Similar to form, the wizard provides an easy way to automatically produce report. Here is a sample in making report in daily sale / transactions. This report includes the transaction date, ISBN and the book title, the book price and the total sale value per day / date.

1. To create this report, we cannot directly get the data from the table, as the report is a combination from several tables. Thus, we must use query as data source for the report. In figure 11.54. we select table pesanan, table item_pesanan, and table buku. Then we select tanggal_pembelian, isbn, judul and harga in the section Field. Then we store it in a file called query_rpt_penjualan_harian (or other name if you like).

Directorate Technical Vocational Education

Page 53: Rekayasa perangkat lunak(Jilid3)

41 Sftware Engineering

Figure 11.54. Query window for source report

2. In Database window select object Report and double click on Create Report by using Wizard. The Wizard report window will be opened and in Tables/Queries select query that has been created in no 1 (Figure 11.55). Then click button >> so that all field in the Available Fields move to the Selected Fields, as shown in Figure 11.56.

Figure 11.55. Selection query as the report data source.

Directorate Technical Vocational Education

Page 54: Rekayasa perangkat lunak(Jilid3)

42 Sftware Engineering

Figure 11.56. Selection of involved fields.

3. Click Next to open the next window as shown in Figure 11.57. In this window we decide the base preview report, whether it is by the table buku or table pesanan. As we will create a daily report, so the review will be based on table pesanan. Remember that field tanggal_pembelian is in table pesanan.

4. Click Next to continue to the next window as shown in Figure 11.58. This window is used to grouping data in the same field. In this particular example, we will not do any grouping so that nothing to be done in the window. Click Next to continue to the next window.

Directorate Technical Vocational Education

Page 55: Rekayasa perangkat lunak(Jilid3)

43 Sftware Engineering

Figure 11.57. Making window to viewing report

Figure 11.58. Making window to grouping data.

Directorate Technical Vocational Education

Page 56: Rekayasa perangkat lunak(Jilid3)

44 Sftware Engineering

5. In Figure 11.59, we may select to sort the data or not. In this section, we will sort the data based on its ISBN number than based on the book title. At Combo Box no 1 select isbn and in Combo Box no 2 select judul. In addition, in this section, we may set whether to create report summary or not. Click on the Summary Options to open summary option window as shown in Figure 11.60. In the field harga, we can check on the box below the Sum. It means, we will report on the number of purchases or daily transaction and total transaction. Close the Summary Option window by clicking OK when we finish it. Then click Next to continue the next window.

Figure 11.59. Window to set data sequence.

Directorate Technical Vocational Education

Page 57: Rekayasa perangkat lunak(Jilid3)

45 Sftware Engineering

Figure 11.60. Window to manage the summary

6. Figure 11.61 shows the window to manage the report lay-out. We may try various lay-outs. In this example, we use block and landscape orientation lay-out. Then, click Next to show the report style window as in Figure 11.62. In this section, we may select the appropriate style. Click next to open the final window of Report Wizard. In the Text Box, we may set the report title. Click Finish to complete the report creation process. The final report result is shown in Figure 11.63.

Directorate Technical Vocational Education

Page 58: Rekayasa perangkat lunak(Jilid3)

46 Sftware Engineering

Figure 11,61. Window to arrange lay-out and orientation

Figure 11,62. Window to arrange style the report

Directorate Technical Vocational Education

Page 59: Rekayasa perangkat lunak(Jilid3)

47 Sftware Engineering

Figure 11,63. Report by Wizard

7. Figure 11.63 shows that the print-out report is unsatisfactory. The column title is using the field name of the table. In addition, the summary wordings, purchase data etc. are a little bit annoying in the view report. To fix it, do right click on the report name in object report window then select Design View. Window similar to Figure 11.64 will be opened.

Figure 11.64. Report in mode Design View mode.

Directorate Technical Vocational Education

Page 60: Rekayasa perangkat lunak(Jilid3)

48 Sftware Engineering


Figure 11.65. Re-Design Report

9. The first fix in this case is column title. We change it to be the same as Figure 11.65. To replace column title, double-click on the column title, and type the new name. We also could arrange the column width by clicking in the highest row to select the whole the column, bring the cursor to the right side of the column to widen the column similar to Microsoft Word.

9. The second fix is to eliminate the Summary words for the date of purchase etc. as shows Figure 11.64. Please click on the Summary section, press Del button on keyboard. In addition, to delete Sum words and change Grand Total with Total Sale. To add line select control line in Toolbar Report, then put it in the selected position. The final Design View will be similar to Figure 11.65. Whereas The Print Preview will be as in Figure 11.66.

Directorate Technical Vocational Education

Page 61: Rekayasa perangkat lunak(Jilid3)

49 Sftware Engineering

Figure 11.66. Print Preview after Re-Design Report


● There are six important things in Microsoft Access objects; Table, Queries, Forms, Reports, Macros and Modules.

● Table in Microsoft Access consist of record (the row) and field (the column). Table may be made by Field definitions with data type, domain and set the primary key.

● Query or the data request may show the data from one table or several related tables. Query in Microsoft Access may be done by using GUI facilities.

● Form is a database object in Microsoft Access that mostly use by beginner to input or output data. Form may be made by Wizard method or manual Design View.

● Report is usually used to present processed data into printer ready information. Report may be manually created or using Wizard facilities.

Directorate Technical Vocational Education

Page 62: Rekayasa perangkat lunak(Jilid3)

50 Sftware Engineering


1. Please see the tables above. Add one of the table named publisher. The attributes are ID Publisher, the publisher name, the address, the city and contact person. Please decide on the type data and data width for this table. Fill in the tables with the publishers you know. You may want to check on your books to check information on the publisher.

2. In the real condition, the publishers relates to the book. A publisher could publish more than one book. However, one book may only published by one publisher. Please create a relation between the new table between table buku and table publisher. If needed, feel free to do some changes in table buku.

3. Please make queries below and attention for the results.

a. Show all the publisher's data. b. Show the publisher's data from Bandung city. c. Show the publisher's data with the book price above RP. 150.000,-. d. Show the publisher which book buy by Cristiano Ronaldo. e. Show the book which buy by Cristiano Ronaldo and Wayne Rooney.

4. Create form to input the publisher's data.

5. Create report to show the list of the publisher and publications.

Directorate Technical Vocational Education

Page 63: Rekayasa perangkat lunak(Jilid3)

51 Sftware Engineering


Figure 12.1. Hardware as Computer Server

Figure 12.1 shows computer servers used at internet service provider or corporate's information technology department. One of the function of these equipments is to act as user's data center. Thus, a strong database application or DBMS is needed. DBMS tool such as Microsoft SQL Server, Oracle, MySQL, PostgreSQL is usually the main choice. The additional functions of DBMS may help increase working speed, security and data accuracy.

In this chapter, three (3) standard of competences, namely, basic Structured Query Language (SQL), advanced SQL programming, and creation of database program for

Directorate Technical Vocational Education

Page 64: Rekayasa perangkat lunak(Jilid3)

52 Sftware Engineering

Microsoft SQL Server. The last two (2) standard of competences is merged due to its similarity. The chapter is structured indirectly refers to the basic competence, but more towards the flow of materials. The summary is in the end of the chapter. Please review the previous chapters on problem solving, basic database fundamental, and database application using Microsoft Access.


● To Prepare and operate SQL software● To Know SQL application menu.● To Make and fill in table● To Operate table and view ● To Use T-SQL ● To Use fixtures Microsoft SQL Server such as procedures, functions, trigger

and XML support ● To Administer a Microsoft SQL Server

12.1. An Overview of Structured Query Language (SQL) DBMS provides language package language to organize the database, such as, the Data Definition Language (DDL) and the Data Manipulation Language (DML).

12.1.1. Data Definition Language (DDL) Data Definition Language (DDL) is one of language package in DBMS to specify the database scheme. Results of DDL compilation is a table set stored in a special file called Data Directory / Dictionary. In general, the DDL commands are related to the creation of new database, drop database, new data table creation, index creation, change structure tables. Examples of DLL are Create Table, Create Index, Alter, and Drop Database,

12.1.2. Data Manipulation Language (DML) Data Manipulation Language (DML) Is a DBMS package to provide user to access or manipulate data to manage the data in a correct data model. DML may do the following activities,

● Take information from the database file.● Insert new information in database.● Delete information from table

There are two DML types, namely, procedural and non procedural. In procedural DML , it needs user to specify the needed data and how to get it. While in non procedural

Directorate Technical Vocational Education

Page 65: Rekayasa perangkat lunak(Jilid3)

53 Sftware Engineering

DML, it needs user to specif icy the needed data without knowing how get it.

SQL is short for Structured Query Language. SQL is closer to DML than DDL, it doesn't mean SQL not provide DDL commands. SQL put more stress to search capability in the table. Searching is an important aspect as it is the focus of data management. Data in database is organized in such way to make it easier in searching it.

As a language, SQL has standardized and several times changed for perfection. SQL is for the first time found in 1970 by name Sequel (is being used until now). The first standard is made in 1986 by ANSI (American National Standards Institute) and ISO (International Standard Organization) called SQL-86. In 1989, SQL-86 is renewed into SQL-89. The last standard is SQL-92.

The SQL statements is used for several tasks, namely, update data in database or show ata from database. Several RDBMS using SQL are Oracle, Sybase, Microsoft SQL Server, MySQL, Microsoft Access, Ingres, etc.. Each database software may have different command / syntax, but in principle, it has the same meaning and function. The main command in SQL is Select. The main command structure is as follows,

Select < column >From < table >Where < condition >

We will use above commands in the following section.

12.2. PREPARING SOFTWARE IN SQL BASE As mentioned earlier, the software used is Microsoft SQL Server. In this chapter, we will use Microsoft SQL Server use 2005 Developers Edition. Brief explanation of Microsoft SQL is in Chapter 10.

12.2.1. Operation Requirements Microsoft SQL Server is a software for Microsoft Windows platform, so automatically using Windows operation system, especially the Server version and has good integration. Also give better indication for security access and allocation work from client-server model..

Microsoft SQL Server has to be activated as server to Windows. The default installation, Microsoft SQL Server will be automatically installed, and it will automatically run every time the Windows is starting. To make sure, please check the

Directorate Technical Vocational Education

Page 66: Rekayasa perangkat lunak(Jilid3)

54 Sftware Engineering

Control Panel, and select Administrative Tool as shown in Figure 12.2. double click at Service icon to open a window as shown in Figure 12.3.

Figure 12.2 Administrative Tool window

Figure 12.3. Services window

At Service window look for SQL server service then check the column status whether it has been started or not. If not started, then start the service.

12.2.2. Operation of SQL based Database software After the installation of Microsoft SQL Server and find GUI client as SQL Server Management Studio. The screen will be shown as Figure 12.4.

Directorate Technical Vocational Education

Page 67: Rekayasa perangkat lunak(Jilid3)

55 Sftware Engineering

Figure 12.4. SQL Server Management Studio

Every time opening SQL Server Management Studio, it will check whether we have right to use SQL Server or not. If SQL Server is run on local machine and uses Windows Authentication then we may press Connect to connect to the SQL Server environment. However, if the SQL server is run on other machine / other server, it will ask for user name and password.

Back to Figure 12.4, there are some important information. It shows that when we will access server type Database Engine, I.e., a server that connects to a database application. SQL Server provides several server types to be accessed but not all will be explained in this book. In the Figure, the example server name is ARM- BLACKMATE. As the SQL Server is installed in a computer named ARM-BLACKMATE and gives the same name as the server for the SQL server.

Directorate Technical Vocational Education

Page 68: Rekayasa perangkat lunak(Jilid3)

56 Sftware Engineering

12.3. MAIN MENU / FEATURES. As we enter the SQL Server environment, SQL Server Management Studio will be shown as in Figure12.5.

Figure 12.5. SQL Server Management Studio.

Figure 12.6. Object Databases

As shown in Figure 12.5, there are two important parts in SQL Management Studio, namely, Object Explorer and Summary Panel. Object Explorer is a place where we see object available in SQL Server. For the time being, the important object for us is the

Directorate Technical Vocational Education

Page 69: Rekayasa perangkat lunak(Jilid3)

57 Sftware Engineering

Databases. While Summary panel is a place for information or summary of object Explorer. Please click to one objects in Object Explorer, so Summary Panel's contents will change according to our object, We will focus to Databases object. Please click on the sign + (or sign node) in front of Databases object as shown in Figure 12.6. In the Figure, there are four (4) available databases in SQL Server, namely, Adventure Works, Adventure Works DW, latihan01SQL and Northwind2007SQL. These four (4) databases are user object as there are made by the user. SQL Server also make its own database during installtion process. This database is normally called system object. Some of the available system object are Master, Model, MSDB, Resource, TempDB, and Distribution. These databases cannot be removed as it may create an unstable system. To check, please click node in front of System Databases. For the time being, we will not touch System Databases. We will focus on user object. Click one of databases, see that screen Summary Panel change. Figure12,7 shows database AdventureWorks contains various component Database Diagrams, Tables, Views and others. Each database we make in SQL server will have these components by default. Although we do not make Database Diagrams for example, they will be there.

Figure 12.7. Database content in SQL Server.

Directorate Technical Vocational Education

Page 70: Rekayasa perangkat lunak(Jilid3)

58 Sftware Engineering


12.4.1. Database Creation

Prior to any table creation, a database must be firstly created. Right click on Databases and choose New Database. Window to create new database will be opened as shown in Figure 12.8. In the textbox in front of Database name, type the database name. In the example, the database name is Lat-01. Click OK. Examine the Object Explorer, new database has formed and has same components as other database.

Directorate Technical Vocational Education

Page 71: Rekayasa perangkat lunak(Jilid3)

59 Sftware Engineering

Figure 12.8. Define new database.

12.4.2. Table Creation. After database is created, we may create table. Right click on Tables component in database Lat-01 and select New Table. Summary panel will be changed as shown in Figure 12.9. You may start put in attribute or column table. The process as same as Microsoft Access. Also for data type, data width and primary key are not too different. The difference is SQL Server provides more data type than Microsoft Access. For the primary key, select the attribute and press the sign key in toolbar.

Figure 12.9. Table Creation

In Figure 12.9, we create table of five (50columns, namely, Student No, Student Name, Address, City, Telephone. With type nchar and varying width data. To fix the data width, please see in the column property. Then save the table in certain name. In the example, the table is save and named siswa. By default, SQL server will give name prefix dbot. However, we can always change it. So table name will become dbo.siswa.

Directorate Technical Vocational Education

Page 72: Rekayasa perangkat lunak(Jilid3)

60 Sftware Engineering

Remove table dbo.siswa by using right click then Delete. Now, create the following table by using the above described process.

Table 12,1. Table, column, type data.

Table Name Column Type and Wide Data Information

Student - Student No.- Student Name- Address- City- Telephone- IdProgram

Nchar (10) Nchar (20) Nchar (30) Nchar (20) Nchar (15) Smallint

Teacher - NIP- TeacherName- Address- City- Telephone

Nchar (15) Nchar (20) Nchar (30) Nchar (20) Nchar (15)

NIP asPrimary Key

Program - IdProgrM- Program'Name- Description

SmallintNchar (20) Nchar (100)

IdProgrAM as Primary Key

Field - IdField- FieldName- Description

SmallintNchar (20)

IdField as Primary Key

Program Teacher - NIP- IdProgram

Nchar (15) Smallint

Both as Primary Key

Field Teacher - NIP- idField


Both as Primary Key

12.4.3. Fill in Data into Table After making tables, we can fill in data, By using GUI SQL Server Management Studio we fill data as same as Microsoft Access. Right click in table's name chose Open Table. New window at Summary panel will open and ready to fill data. Figure 12,10 shows how fill data to a table. Every time we fill in one line, then make sure to press Enter. Try to fill in the other tables.

Directorate Technical Vocational Education

Page 73: Rekayasa perangkat lunak(Jilid3)

61 Sftware Engineering

Figure 12.10. Filling table


12.5.1. Relation Between Tables

So far, our tables are basically independent tables and no relation between table. If we examine, we can create relation between table as shown in Chapter 10 and Chapter 11 on the relation between table. Table siswa relates to table program, table teacher relates to table field and table program. To create relation between table, we may use Database Diagrams components. Right click on Database Diagrams then select New Database Diagram. A new windows as shown in Figure 12.11 will be opened.

Figure 12.11. Window for relation between table

Directorate Technical Vocational Education

Page 74: Rekayasa perangkat lunak(Jilid3)

62 Sftware Engineering

On Add Table window, click Add to select the tables for relations. In this example, we select all tables as they are all related. Click many times until no table in Add Table window. After all tables selected, create the relation as shown in Figure 12.12. To relate one table to the other is similar to Microsoft Access. Keep the diagram.

Figure 12.12. Relations between tables

12.5.2. View Creation View is same as Query on Microsoft Access. SQL Server provides GUI feature same as GUI Query on Microsoft Access. To create View, right click at View and select New View as in Figure 12.13. Select Add Table and add one or more table. For example we use table siswa. Click Close to close window as see Figure 12.14.

There are four important parts as shown in Figure 12.14, namely, Diagram window, Criteria window, SQL window and Result window. Diagram window uses as source tables to be used in View. Criteria window is a place for criteria in View. SQL window is a place to write SQL command for View. Result window is a place to see View.

Directorate Technical Vocational Education

Page 75: Rekayasa perangkat lunak(Jilid3)

63 Sftware Engineering

Figure 12.13. Window for making table then View.

Directorate Technical Vocational Education

Page 76: Rekayasa perangkat lunak(Jilid3)

64 Sftware Engineering

Figure 12.14. Window making View.

In Figure 12.14, we select table siswa as View source and it shows in the Diagrams window. We will make simple View based on this table. Click *(All Columns) under table siswa. Contents of the SQL window will automatically changed. It will be the same as what we have done in Diagram and Criteria window. Click on ! Mark in toolbar to execution View or right click in one of Figure 12.14 it may be Diagram / Criteria / SQL / Result window then select Execute SQL. See Figure 12.15. Save this View by clicking diskette icon on Toolbar and provides the View name.

Directorate Technical Vocational Education

Page 77: Rekayasa perangkat lunak(Jilid3)

65 Sftware Engineering

Figure 12.15. Results View execution.

Please note that all steps in making View is the same as making Query to Microsoft Access. Let us now create a more complex examples. Examine the following examples.

Example 12.1. View to show Teacher's name and their address outside Malang City.

Use table Teacher as View source. Create View as shown in Figure 12.13 windows. Select table Teacher then Close. Click Name, Address and City in box of table Teacher. At Criteria window, select City, select row City and in column Filter type statement <> ‘Malang’. Execute this View, you will get the results as Figure 12.16.

Directorate Technical Vocational Education

Page 78: Rekayasa perangkat lunak(Jilid3)

66 Sftware Engineering

Figure 12.16. Results of View execution of example 12.1.

The Filter Column in Criteria window is used to select the row to our need. In the above example, we use row to select City that is not ‘Malang’. We use sign <> to state not equal.

Example 12.2. View to see Student's name, Id number, and field of study in alphabetical order.

For this example, we need a minimum of two (2) tables, namely, table siswa and table Program. See relations between table in Figure 12.12. Table siswa directly connects to table Program using the same process as in Figure 12.13, In Student box in table siswa select name and NoInduk while in Program box select NamaProgram. In Criteria windows, select Name row and click on Sort Type column then select Ascending. Execute the View. We will see the result similar to Figure 12.17. Examine the Result windows, name column is shown in alphabetical order.

Directorate Technical Vocational Education

Page 79: Rekayasa perangkat lunak(Jilid3)

67 Sftware Engineering

Figure 12.17. Results of View execution of example 12,2.

Example 12,3. View to show Teacher's name and field of expertise in alphabetical order.

Base on table relations in Figure 12.12, it needs three (3) tables, namely, table Teacher, Teacher's Field and Field. Column Name is in table Teacher, while Field column is in table Field. Select the three (3) tables. At Teacher's box in window Diagram select Name. At Field's box select Field Name. Finally, at Criteria window select Name row and click on Sort Type – then Ascending. Execute this View.

Directorate Technical Vocational Education

Page 80: Rekayasa perangkat lunak(Jilid3)

68 Sftware Engineering

Figure 12,18. Results of View execution of example 12.3.

12.6. T-SQL USAGE Transact-SQL (T-SQL) is a variant of SQL database language from Microsoft company and Sybase. Microsoft SQL Server recognizes onlyT-SQL SQL language. Thus, to use Microsoft SQL Server, we must understand T-SQL.

In General, T-SQL is not too different with the standard SQL. In fact, T-SQL is a standard SQL language with addition of several special commands to help work in SQL Server. The commands SELECT, FROM and WHERE mentioned earlier, is some of the main command in T-SQL.

To create T-SQL commands, we may use the Query window in the SQL Server by clicking New Query button in the Menu Bar as shown in Figure 12.19. Prior to it, select the database to bused by clicking the database name in the Object Explorer. In the opened Query window, we may type the SQL commands.

Directorate Technical Vocational Education

Page 81: Rekayasa perangkat lunak(Jilid3)

69 Sftware Engineering

Figure 12.19. The query window.

12.6.1. Defining Table using T-SQL Almost all activities in SQL Server may be done by using T-SQL commands, including create table. In previous chapter, it has been explained that we can create table by using GUI facilities or SQL commands. Table definition commands are part of DDL. Command to define or create a new table is CREATE TABLE. While command to drop or remove the table is DROP TABLE.

Create a new database called Lat-01 SQL. Then select it. Open Query window as shown in Figure 12.18. We will make the same tables as Lat-01 but using SQL command. The first table is the table Siswa, see the structure in the above table 12.1. Type in the following command, then execute by clicking (!).

CREATE TABLE [dbo].[Field]( [IdField] [smallint] NOT NULL, [Field'sName] [nchar](20)NULL, [Description] [nchar](100)NULL,

Directorate Technical Vocational Education

Page 82: Rekayasa perangkat lunak(Jilid3)

70 Sftware Engineering


CREATE TABLE commands follows with table name ([dbo]. [Field]) then follows by column list on the table. In the column list, data type, data width, and other condition (NULL NOTE or NULL) must be listed. After that then write CONSTRAINT section of the table. In the CONSTRAINT, the Primary Key is defined. Examine how to write the commands.

After execute it, examine the table node section to see if the table created or not. Right Click on Tables database in Object Explorer, and select Refresh. You will find Object Tables. Create the other tables in the same way. Here are the commands to create tables.

Table Program CREATE TABLE [dbo].[Program]( [IdProgram] [smallint] NOT NULL, [Program'sName] [nchar](20) NULL, [Descriptions] [nchar](100) NULL, CONSTRAINT [PK_Program] PRIMARY KEY CLUSTERED ( [IdProgram] ASC )WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY] ) ON [PRIMARY]

Table TeacherCREATE TABLE [dbo].[Teacher]( [NIP] [nchar](15) NOT NULL, [Nama] [nchar](20) NULL, [Alamat] [nchar](30) NULL, [Kota] [nchar](20) NULL, [Telepon] [nchar](15) NULL, CONSTRAINT [PK_Teacher] PRIMARY KEY CLUSTERED ( [NIP] ASC )WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY] ) ON [PRIMARY]

Table StudentCREATE TABLE [dbo].[Student]( [IdNumber] [nchar](10) NOT NULL, [Name] [nchar](20) NULL, [Address] [nchar](30) NULL,

Directorate Technical Vocational Education

Page 83: Rekayasa perangkat lunak(Jilid3)

71 Sftware Engineering

[City] [nchar](20) NULL, [Telephone] [nchar](15) NULL, [IdProgram] [smallint] NULL, CONSTRAINT [PK_Student] PRIMARY KEY CLUSTERED ( [IdNumber] ASC )WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY] ) ON [PRIMARY]

Table TeacherProgramCREATE TABLE [dbo].[TeacheProgram]( [NIP] [nchar](15) NOT NULL, [IdProgram] [smallint] NOT NULL, CONSTRAINT [PK_TeacheProgram] PRIMARY KEY CLUSTERED ( [NIP] ASC, [IdProgram] ASC )WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY] ) ON [PRIMARY]

Table Teacher FieldCREATE TABLE [dbo].[TeacherField]( [IdBidang] [smallint] NOT NULL, [NIP] [nchar](15) NOT NULL, CONSTRAINT [PK_TeacherField] PRIMARY KEY CLUSTERED ( [IdField] ASC, [NIP] ASC )WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY] ) ON [PRIMARY] In the above commands to create tables, we have not yet done any relation between table. Relation between table in SQL is usually set by using FOREIGN KEY command. Please review the FOREIGN KEY in Chapter 10 and 11. We need to modify table by adding CONSTRAINT so that the table could understand relations between tables. Open again Query window then type in the following commands.

ALTER TABLE [dbo].[Student] WITH CHECK ADD CONSTRAINT [FK_Student_Program] FOREIGN KEY([IdProgram]) REFERENCES [dbo].[Program] ([IdProgram]) ALTER TABLE [dbo].[TeacherProgram] WITH CHECK ADD CONSTRAINT [FK_TeacherProgram_Teacher] FOREIGN KEY([NIP]) REFERENCES [dbo].[Teacher] ([NIP])


Directorate Technical Vocational Education

Page 84: Rekayasa perangkat lunak(Jilid3)

72 Sftware Engineering

[FK_TeacherField_Field] FOREIGN KEY([IdField]) REFERENCES [dbo].[Field] ([IdField])

ALTER TABLE [dbo].[TeacheField] WITH CHECK ADD CONSTRAINT [FK_TeacherField_Teacher] FOREIGN KEY([NIP]) REFERENCES [dbo].[Teacher] ([NIP])

Commands to modify or change table structure is ALTER TABLE, then follow by table name to change. Examine the command ALTER TABLE [dbo]. [Student] WITH CHECK ADD CONSTRAINT [FK Student_Program] FOREIGN KEY ([IdProgram]). The table to be modified is dbo.Student to connect with table Program, so will write FK_Student_Program. IdProgram Column in table Student is the FOREIGN KEY, and will write as FOREIGN KEY ([IdProgram]). IdProgram column is originated from table Program, thus at the last command must be written the table reference (write: REFERENCES [dbo]. [Program] ([IdProgram])). All relations between tables make as same way above.

The DROP TABEL command is very easy to do, just add table name in front of command. For example: DROP TABLE [dbo]. [Field].

12.6.2. Fill in, Change and Remove Table contents by SQL After making all tables, we can fill in data on each table by using INSERT. This command is in DML group. We will try to use it at table Field. Check the contents of table Field by right click at table name, then select Open Table. Table contents may be seen in the Summary window as shown in Figure 12.20. Close again Open Table window.

Figure 12.20. Contents table Field

Open Query window, type command as follow:.

Directorate Technical Vocational Education

Page 85: Rekayasa perangkat lunak(Jilid3)

73 Sftware Engineering

INSERT INTO [Lat-01].[dbo].[Field] ([IdField] ,[FieldName] ,[Description]) VALUES (8, 'Networking Wireless', NULL)

INSERT command follow by database name and table name ([Lat- 01]. [dbo]. [Field] ), then follow by column name at that table. VALUES key word is used to provide guidance that the next keyword would the data entry. Please note that as there is three (3) column in table Bidang, we need to enter three (3) data. Th first data (8) must be filled in the definition of table Bidang, IdBidang is NOT NULL. And the third column Description, we may fill NULL as we want to empty column contents.

Do the above command. Click right at table Field, select Refresh. Click right again at table Field and select Open Table. All data in table Field is shown in Figure 12.21.

Figure 12.21. Contents of table Field after INSERT data.

As shown above, INSERT command may be too long. Try to remove name list using the command. Replace data under VALUES to (9, 'Digital Animation', NULL). Execute and see the results. What happen? After Refresh, you will see your data also can input without calling names list column at INSERT command.

Sometimes, when we make mistake during data entry. It may be typing error typing or reading error. If we want to fix the data, it may be done bu using data update. SQL provides UPDATE command to perform this process. All command is included in DML group.

For example, we want to change the 5th content of FiledName on IdField column as shown in Figure 12.21. From 'Photography' into 'Digital Photography', we type the

Directorate Technical Vocational Education

Page 86: Rekayasa perangkat lunak(Jilid3)

74 Sftware Engineering

following command.

UPDATE [Lat-01].[dbo].[Field] SET [FieldName] = 'Fotografi Digital' WHERE [IdField] = 5

Recheck contents of table Field. Don forget to refresh table Field before clicking Open Table.

To remove data using SQL, it can be done by using DELETE command. Please note that DELETE command will delete the contents in a row. If you only want to make empty only part of contents in a row or one cell just use UPDATE command. For example, we want to remove row with IdField equal to 8 then we have to type the following command. DELETE FROM [Lat-01].[dbo].[Field] WHERE [IdField] = 8

12.6.3. Search and View Data by SQL

As mention at early chapter, main command in SQL is SELECT, FROM, and WHERE. Most of our activities will use these SQL commands. To use these commands, open window and then query, type your command. Run by pressing mark (!).

SELECT command use to select column. If we want to show all column, we simply use the sign *. FROM command is used to select which column for data source. WHERE command is used to limit the row to be shown to maintain the performance. WHERE may be from table or from other View results. Examine the following example of using SQL.

Example 12.4. Show all data in table Filed. In this example, we use table Field with all column used. We use sign * or register all columns in table Field. Here is the SQL command and the execution result.

If you want to save the above View command, before SELECT command, add CREATE VIEW <name_view> AS. Replace <name_view> with the name that you want.

Example 12.5. Show Student's name and address.

In this example, we use table Student. In table Student, we use name, address, and city column. We can not use * sign, but register name and address column after

Directorate Technical Vocational Education

Page 87: Rekayasa perangkat lunak(Jilid3)

75 Sftware Engineering

SELEC command. Note the following SQL command.

Example 12.6. Show student's name who live in Batu.

In this example, we use WHERE statement to limit the shown row. We use table Student and column name. As shown in Figure 12.2, there are only two (2) students in Batu, namely, Pepe Richard and Bubi Red. WHERE statement should be followed by the condition to met. In this case is City = 'Batu'. Here are the full SQL command and output. Please examine how to write it.

Example 12.7. Show data of name, address and city for teacher who not living in Malang

Directorate Technical Vocational Education

Page 88: Rekayasa perangkat lunak(Jilid3)

76 Sftware Engineering

In this example, we use WHERE statement to limit the data shown. We use table Teacher and name, address and city column. Statement, not living in Malang is the condition to be met. The complete statements is as follows

Example 12.8. Show student's name and program.

In this example, we will use two related tables, namely, table Student and table Program. We want to show name column from table Student and NamaProgram Column from table Program. In this case, database name should be added prior to column name in SELECT command. Please note that as shown in Table 12.1, in table Student there is a Foreign Key, namely, IdProgram that is the Primary Key in table Program. Id Program is used as the connector between these two tables. Please examine the following SQL command and its result.

Directorate Technical Vocational Education

Page 89: Rekayasa perangkat lunak(Jilid3)

77 Sftware Engineering

Example 12.9. Show student's names who takes Software Engineering Program. This is the continuation of Example 12.4. We add WHERE statement to show the name who take Software Engineering Program. We want to show name of from table Student. Examine the following SQL statement and the result.

Example 12:10. Show teacher's name and field of expertise.

This example is more complex than others. It involves three (3) tables, table Teacher, table Teacher_Field and table Field. See the relations between table in Picture 12:11. There is two INNER JOIN to be used, namely, INNER JOIN table Teacher and table Teacher_Field and INNER JOIN Teacher_Field and table Field. Examine how to make INNER JOIN statement.

Example 12.11. Show teacher's name whose expertise is in Web or Database Programming

This example is an expansion of example 12.10. We will show teachers whose expertise in Web and Database Programming. We need to add WHERE command to limit the row. In addition, we will use OR operator in WHERE statement. Examine the SQL commands and the execution result.

Directorate Technical Vocational Education

Page 90: Rekayasa perangkat lunak(Jilid3)

78 Sftware Engineering

Compare with the result in Figure 12.10. Try to replace OR with AND and re-run SQL command. How is the results?

All above examples may be expanded into many variations. With some practice, you will understand how use SQL commands.

12.7. FUNCTION, PROCEDURE DAN TRIGGER Microsoft SQL Server provides some advanced facilities that are not provided by Microsoft Access, such as create functions, store procedure and trigger. This is because SQL Server is aimed to be used as database server which requires stronger performance as compared with Microsoft Access.

12.7.1. Function T-SQL provides many functions to make easy in database management tasks. Some of the important functions will be presented here. For more information please read the manual or online help from the SQL Server.

● Function related to numeric

The important functions related to numeric (number) are isNumeric and Round. Function IsNumeric is used to check whether a data contains data number or not. Open Queries window, type command as shown in Figure 12.12, see the results. Table Student has phone column where the data seems to be numbers. We can check by function isNumerik. In the execution results, it shows that all are 0 that means false. Thus, all phone's data is not numeric data.

Directorate Technical Vocational Education

Page 91: Rekayasa perangkat lunak(Jilid3)

79 Sftware Engineering

Example 12.12. Usage of is Numeric function.

ROUND function is used to round a number fraction to the nearest round number. For example 13:58 to 14:00. Examine the following example.

Example 12.13. Round Function

● Functions related to String

Functions related to character (string) are LEFT, RIGHT, LEN, LOWER, UPPER, LTRIM, and RTRIM.

LEFT is used to select a certain number of character on the left, while RIGHT is similar to LEFT for the right character. The result depends in the data width during table creation. To know the length of data, LEN may be used. Please examine the following example.

Example 12:14. Use of LEFT, RIGHT and LEN.

Directorate Technical Vocational Education

Page 92: Rekayasa perangkat lunak(Jilid3)

80 Sftware Engineering

LOWER used to alter the character into small case, while UPPER is to convert into capital case. LTRIM use to remove space on the left of data string, while RTRIM on the right of data string. Please examine the following example.

Example 12:15. Use of UPPER and LOWER.

Directorate Technical Vocational Education

Page 93: Rekayasa perangkat lunak(Jilid3)

81 Sftware Engineering

● Functions related to TIME

Some of the important functions related to time are GETDATE, MONTH, DAY, YEAR, DATENAME, DATEADD, and DATEDIFF. GETDATE use to get date from current system computer. MONTH use to retrieve month from data date. DAY use to retrieve date from data date. YEAR use to retrieve year from data date. DATENAME use to get name day from data date. DATEADD use to increase or reduce data date DATEDIFF use to see difference between two data date. Examine the following example.

Example 12:16. Use time function.

12.7.2. Procedure and Stored Procedure Beside the above functions, SQL Server introduces user-defined function. These functions can be created to speed up access for management database. There are two types user defined functions, namely, scalar and inline-table value. Scalar function produces an output by Return keywords. Inline Table-Value produces a new table when execute. Examine the following example.

Example 12.17. Create a scalar function

The function in Figure 12.17 is called dbo.FullName. It uses two parameters, namely, @firstname and @LastName. Examine how to define the function and its parameters.

The output from function has types nVarChar data with data width of 35. This function provides a value output such as combination from @LastName and @Firstname. Both of them in scalar function.

The blocked code in Figure 12.17 shows how the function is called in a query. There will be a new column contains a combination of LastName and firstname.

Directorate Technical Vocational Education

Page 94: Rekayasa perangkat lunak(Jilid3)

82 Sftware Engineering

Stored procedure is a code that can receive input parameter and produce one or more output parameters. In generally, Stored procedure is used for operations in database. Usually a complicated, long and complex SQL commands may be stored as procedure. Thus, we do not need to retype it again. All we need to do is call the name of Stored procedure and execute it.

Command to create Stored procedure is CREATE PROCEDURE, follow by name procedure. Examine the following example.

Example 12.18. Create Stored Procedure

Open Query window, then type the following code.

CREATE PROCEDURE deletelines @IdNumber smallint

Directorate Technical Vocational Education

Page 95: Rekayasa perangkat lunak(Jilid3)

83 Sftware Engineering

AS DELETE FROM dbo.Field Where dbo.Field.IdField = @IdNumber

Procedure we create call deleteLine with one parameter @ IdNumber with type data smallint. When Stored procedure process, statement after AS is same as statement SQL.

12.7.3. Trigger

Trigger is special type of Stored procedure and will execute if something happen. For example, additional data (INSERT), remove data (DELETE) or change data (UPDATE). Trigger is usually component of a table.

To create a trigger, click on node in front of the selected table. After it shows the list of table component, do right click on Trigger and select New Trigger. SQL Server will show new windows containing Trigger template. Delete all text in the window and type following example.

Example 12.19. Create a Trigger.

CREATE TRIGGER try_trigger ON dbo.Field FOR INSERT AS DECLARE @varName Varchar(20) SELECT @varName = NameField FROM INSERTED PRINT 'you input data : ' + @varName

The above Trigger is in table Field. The Trigger name is try_trigger and will be executed in the INPUT event in table table dbo.Field.


12.8.1. Security and Authentication.

Database Security is an important component. The SQL as a server may theoretically be accessed by anyone. This will be very harmful if irresponsible people do some changes, do destruction or even delete important databases.

SQL Server provides Authentication mechanism to limit the privilege o access the database SQL Server. There are two authentication models, namely, Windows Authentication and SQL Server Authentication.

Directorate Technical Vocational Education

Page 96: Rekayasa perangkat lunak(Jilid3)

84 Sftware Engineering

● Windows Authentication. In this model, SQL Server does not perform checks on user name and password, but let windows operating systems take the responsibility. Thus, only registered Windows users may access the SQL server.

● SQL Server Authentication. Information of user name and password stored in SQL Server so each time users will connect, SQL Server will check it.

To see the authentication models in SQL Server, do right click on server name in Object Explorer window and select Properties. In Server Properties window select Security so it will be shown as Figure 12:22.

Figure 12.22. Security Pages on Server Properties window

Directorate Technical Vocational Education

Page 97: Rekayasa perangkat lunak(Jilid3)

85 Sftware Engineering

To add user for SQL Server authentication, click node Security in Object Explorer, right click on Logins. Select New Logins to open window as shown in Figure 12:23. Create the new user.

Figure 12.23. Window for new user

12.8.2. Permissions Permissions relates to user right access on database. Someone who has register as user on SQL Server does not automatically be able to the database if he / she doesn't have the rights. To change user's rights on particular database, click node on Login. Right click on user name (list under Logins) and select Properties. Select User Mapping as shown in Figure 12:24.

Directorate Technical Vocational Education

Page 98: Rekayasa perangkat lunak(Jilid3)

86 Sftware Engineering

Figure 12.24. User Database Right Access.

The above picture shows the use with name SA to be the owner (db_owner) from several databases that shown as checked database on the list. We can set (role) a member in database check list by checking or not checking on Database role membership.


● Data Definition Language (DDL) is a DBMS language package to specify the database scheme, while Data Manipulation Language (DML) is a DBMS package to provide user access or manipulate data as organize in appropriate models data.

● SQL put more stress on table search aspects because search is the core of data management.

● Creation of Table and View in SQL server may be done by GUI or using SQL commands.

Directorate Technical Vocational Education

Page 99: Rekayasa perangkat lunak(Jilid3)

87 Sftware Engineering

● The main SQL commands are SELECT, FROM, and WHERE.● Microsoft SQL Server provides built-in functions and user-defined Function. ● Stored procedure is a snip code program to receive parameter input and

produce one or more output parameters. Trigger is a special type of Stored procedure that will execute when something happen.

● SQL Server provides Authentication mechanism to limit whom entitled to enter the SQL Server system with two models, namely, Windows Authentication and SQL Server Authentication. In addition, data security is also protected by the permissions.


1. Create new table by using GUI facilities on database Lat-01 with name SubjectName and the following columns, namely, Id Subject, name, description, Semester, and Time schedule. In Semester column indicates which semester this subject is given, on Time schedule shows how many time / hours for the subjects to be teach. Both column should use data type data numeric, you may choose either smallint or int on type data. Fill that table with subjects your school.

2. How is the SQL commands to create table for no. 1

3. In real conditions there is relationship between subjects and teachers. As teacher will teach the subjects. Make relation between table Teacher with table Subject on Database Diagrams. If needed, please add new column or tables to fix the relations. (note: set the cardinality relations whether one-to-many, or many-to-many)

4. Create View with SQL commands as follows: a. Show all data subjects. b. Show subjects at school of 3 semester to up (use sign>, <,> = and <= WHERE) c. Show chapter of lessons by less than 3 times meeting. d. Show all subjects and teachers name. e. Show subjects at schools and teacher's name at semester 4.

Directorate Technical Vocational Education

Page 100: Rekayasa perangkat lunak(Jilid3)

88 Sftware Engineering


Figure 13.1. A Web Page.

If you surf often in the Internet , you will see the web pages such as in Figure 13.1. Some of these Web pages are static, but some are dynamics. Whatever the type of the page, all pages are almost certainly involving HTML language.

This chapter will discuss two (2) standard of competences, namely, basic static web and create HTML file. These two (2) standard of competences is combined as it is fairly similar. The standard competence in creating HTML file has four (4) basic competences, namely, defining a file structures, creating the HTML files, format file and add object. The standard of competence in basic static web has four (4) basic competencies, namely, explain the basic concept and web technology, preparing web creation, designing web and displaying web pages in the browser.

Directorate Technical Vocational Education

Page 101: Rekayasa perangkat lunak(Jilid3)

89 Sftware Engineering

The summary is located at the end of the chapter, followed by exercise questions which has been prepared, from the easiest to difficult. The exams are used to measure the ability of this basic competence. Prior to learn the competence, try to remember the basic of computer system, operating systems, algorithms and basic programming.


After learning this chapter, it is hope that you will be able to.

● Explains the basic concepts and technology web.● Define the structure and use of documents● Preparing the work of making the web

Conducting the creation of new web documents and display in a web browser.● Create documents with the structure of the HTML language.● Formatting a document and add the object.● Create table.● Making the link between documents

13.1. BASIC CONCEPT AND WEB TECHNOLOGY World Wide Web is widely known as a Web. The Web is introduced in 1992. The web is a research result of CERN in Switzerland. Internet and web are two different things. Internet is the physical / hardware infrastructure, while web is the application running on top of the infrastructure. The protocol used is different. Internet uses TCP / IP protocol, while web uses HTTP (Hyper Text Transfer Protocol).

The web is prepared from a pages that used a web technology and linked one to another. A standard web technology has currently been defined. Although, its implementation has not been fully supported by all web developers. The standard is prepared by the World Wide Web Consortium (W3C). These standards are needed as more variation in the web technology may create incompatibility among them.

13.1.1 Web Technology Standard.

In general, the web design technology is divided into several layers , such as, structural layer, presentation layer and the behavioral layer.

● Structural layer

This layer is related to the structure of web documents. How a structured documents, what format is used, the mark or mark up what used to be part of this layer. The recommended standard technology is the Extensible Hypertext Markup Language (XHTML) and Extensible Markup Language (XML). XHTML

Directorate Technical Vocational Education

Page 102: Rekayasa perangkat lunak(Jilid3)

90 Sftware Engineering

is the latest version of HTML (4.01) is written back with the rules more stringent refer to XML. Meanwhile, the XML is a set of rules to prepare markup language.

● Presentation layer

This layer is related with the way in setting the document on the screen, the sounds , or the documents printing format. In the previous web technology, this part is inside a structural layer. But in the new standards, it is separated. The Cascading Style Sheets (CSS) is included in this technology.

● Behavioral layer

This layer is related to the use of the script language and its programming to enhanced the interactive preview and the dynamics of the web pages. Included in this layer is the Document Object Model (DOM) and JavaScript. DOM allows a document or the script to access or update the content, structure and style of documents. JavaScript is a technology that is quite mature and still used to add documents to be more interactive.

13.1.2. Static and Dynamic Web. The web page can be classified into the static and dynamic web. The definition of static and dynamic web is sometimes debatable. Some internet users said, if the web pages has an animations then it's called the dynamic web. If the web pages contain only text and images that are not moving, it's called static web. However, based on the agreement, statics and dynamics web is not determined by any of the animations or moving web pages, rather by the content or information in the these pages.

The Data and information on a static web is not changed. The web document which is sent to the client will be similar with the one on the web server. Meanwhile, a dynamic web, have data and information vary depending on what the client's input / request. Documents on the clients may be different than the document on the web server.

When you open Google, it is the easiest ways to look the difference between a static and dynamic web. The starting page is static as we do not see any changes in content or information. This page will have the same view both on client computer or on the web server. However when we submit the keyword in the text box and then press the search button, we are interact with Google's web server. Web server will send a page web in accordance with the client request. The appearance on the client side will be a list of information addresses. Meanwhile, in the the server, the document is a list of the searching codes.

This chapter will specifically learn about the creation of static web while the dynamic web will be described in Chapter 14.

Directorate Technical Vocational Education

Page 103: Rekayasa perangkat lunak(Jilid3)

91 Sftware Engineering

13.2. PREPARATION TO CREATE A WEB Creating a web page requires some preparations, not only the knowledge on web page design, but also hardware support, software support, etc.

13.2.2. The Hardware The hardware requirements for the creation of web pages is not much different than normal computing needs. A complete set of computer with a CPU, monitor, keyboard, mouse, printer and some enhancements that can be used to create web pages. The specification depends on the the software that will be installed on the computer. If we install a web server, image processors to design web pages, HTML editor complete, we certainly need a higher specification computer.

13.2.3. The Software

● Operating System

The operating system has an important role in web development, because on top the operating system resides web servers, a web editor, a data base management system and a programming language. This means the choice of a operating system determined the selection of a a web servers, developer tools and the programming language that will be used. This is because of compatibility problems between the software. For example, if we choose to use Linux operating system then we can not install IIS as the web server.

In addition to compatibility problems, other things also need to be considered in the determination of the operating system that will be used on the server such as, a security, a stability, easy of configuration. Security associated with the operating system the ability to protect themselves attacks from viruses, spams, or malicious code that deliberately inserted. This capability is crucial because the data traffic in Internet is very vulnerable to viruses, spams, and another attacks. Stability related to the ability of the operating system to work continuously to respond to client requests. Easy in configuration is related to the easiness of the operating system in acting its role as a server.

● Web Server

Web server software is acting to serve the request from clients on specific web pages. There are several popular in web servers. Among them is the Apache and an IIS (Internet Information Service). As of December 2007, Wikipedia

Directorate Technical Vocational Education

Page 104: Rekayasa perangkat lunak(Jilid3)

92 Sftware Engineering

noted that Apache is ranked number one position as the mostly used web server, followed by IIS.

Apache can be used both for the static and dynamic web and supported in many operating system platforms and programming languages servers, including Perl, Phyton, Java (JSP using Tomcat) and of course PHP. The security features are also perfectly handled. Support connection to various databases, such as MySQL, SQL Lite, PosgreSQL, Oracle, DB2 as well as others. Figure 13.2 shows how a web server Apache (httpd) is used in Linux.

Figure 13.2. Running apache service (httpd) on Linux.

IIS is Microsoft's web server. A web server for IIS is not too precise, because beside as web server, the IIS provides a file server, email servers and other Internet based service. Therefore, the appropriate term is probably the Internet-based service. This software bundled in the Microsoft's Windows operating system. But in default is not directly installed. You have to installed it manually . Figure 13.3 shows how to install IIS.

Directorate Technical Vocational Education

Page 105: Rekayasa perangkat lunak(Jilid3)

93 Sftware Engineering

Figure 13.3. Checking and installation of IIS.

Directorate Technical Vocational Education

Page 106: Rekayasa perangkat lunak(Jilid3)

94 Sftware Engineering

● Web / HTML Editor

Web / HTML editor is a web developer software both for a static and dynamic. In the software market, currently available many types of web developer tools, ranging from simple to the sophisticated and complex. But actually to create a web page both static and dynamic we can use a normal text editor, such as Notepad or vi. Unfortunately, normal text editor does not provide facilities to make it easier to create a web page. In complex developer tools, such as Adobe Dreamweaver (previously Macromedia Dreamweaver), Microsoft Visual Studio .Net, and some others, we will find the facilities to help accelerate the creation of a web page, among others: Appearance-based GUI, automatic code completion (complete code automatically), WYSIWYG (What You See Is What You Get) HTML Editor, connection to the database easier, and more facilities. Of course, this tools are valuable and relative expensive. In other parts of this chapter you will be asked to identify some of these softwares.

● Web Browser

Web browser translates HTML codes to what we view on screen. There are many Web Browser on the Internet. Almost all of us may download it for free. Some of the popular Web browsers are Microsoft Internet Explorer, Firefox, Opera or Safari. Microsoft Internet Explorer is the default web browser on the Microsoft Windows operating system as shown in Figure 13.4. Firefox is the default web browser on most of Linux operating systems. Safari is the default Web browser in the operating system Mac OS X as shown in Figure 13.5. While the Opera web browser is the product of Opera Software that may run on multiple operating systems as shown in Figure 13.6.

Directorate Technical Vocational Education

Page 107: Rekayasa perangkat lunak(Jilid3)

95 Sftware Engineering

Figure 13.4. Microsoft Internet Explorer.

Directorate Technical Vocational Education

Page 108: Rekayasa perangkat lunak(Jilid3)

96 Sftware Engineering

Figure 13.5. Safari.

Directorate Technical Vocational Education

Page 109: Rekayasa perangkat lunak(Jilid3)

97 Sftware Engineering

Figure 13.6. Opera.


There are two models in the creation of a static Web page. The first is to create pages on the local computer, and then after successfully moved to a location on the web server. The second model is directly create web pages on the web server location. Location of the web the server can be a computer in the same place with the creation of web page or on other computers that act as a server. The first model more easily, because the work does not require a web server on the stage design. In this section we will try this way.

Create a directory on the computer for you. If you use a windows operating system you can open Windows Explorer and right click in the area of Windows and select New and then select Folder. Give it a name LatihanWeb for instance. If you use a Linux, open the file manager available such as Konqueror, Nautilus, or Thunar. Do the same waysuch as in Windows Explorer.

Directorate Technical Vocational Education

Page 110: Rekayasa perangkat lunak(Jilid3)

98 Sftware Engineering

In general, a website contains not only a web page, but also a collection from several web pages related to that. Usually Web developers create the directory structure to facilitate the setting page. Note the directory structure of a Web site in Figure 13.7.

Figure 13.7. Example of directory of Web site.

The starting page of a website is usually a web page called homepage. It is usually given the name index.html (or may also be index.php, index.jsp, index.asp if scripting language is used on the server). In the same directory with index.html there are another directories that are grouped based on the themes or groups. In addition, there are another directories that stored the elements used by the web pages, usually contains the files of pictures, text, audio, video or other elements.

Create the directory structure as the above by adding sub directory under the directory LatihanWeb that you have created. Give appropriate name you desire, but earned the name of the directory shows what the content of the directory. Open a text editor, such as Notepad and then type the code, following.


Directorate Technical Vocational Education

Page 111: Rekayasa perangkat lunak(Jilid3)

99 Sftware Engineering

<TITLE>Homepage</TITLE> </HEAD> <BODY> Ini halaman index pertamaku </BODY> </HTML>

Save as index.html and place it in the directory LatihanWeb as shown in Figure 13.8. To test the file, double click on the file index.html you will get a view as in Figure 13.9.

Figure 13.8. Index.html file and the location of storage.

Directorate Technical Vocational Education

Page 112: Rekayasa perangkat lunak(Jilid3)

100 Sftware Engineering

Figure 13.9. The results of the test index.html file.

13.4. HTML

13.4.1. Understanding the HTML Figure 13.8 and 13.9 shows how to make simple web pages. The Web page that you have created is using a language called a HTML (hypertext markup language). The HTML is a development of the standard formatting text documents, namely the Standard Generalized Markup Language (sgml). The HTML document is actually ASCII or plain text, which is designed to not depend on a system certain operations.

The HTML created by the team when Barners-Lee was working for the CERN. The HTML being popular at the first time by the Mosaic browser. During the early 90's, the HTML is growing very rapid. Every development of HTML will add of capacity and better facilities than previous versions. The rapid growth s not changed the work flow of HTML.

A document or an HTML files that can be read directly by the the browser has an extension. htm or. html. To write the HTML is not requiring a specific software, just a simple text editor such as Notepad (on Windows) or a variety of text editors in the Linux and Apple Mac OS, such as vi, nano, joe, gedit, and other leafpad other. Some editors provide extra features such as syntax coloring (color-code in the HTML code) and code completion (complete automatically code that will be written). Currently, there are many many GUI-based tools that helps in making the HTML pages. Macromedia Dreamweaver and Microsoft FrontPage is a two the name is quite popular in the

Directorate Technical Vocational Education

Page 113: Rekayasa perangkat lunak(Jilid3)

101 Sftware Engineering

Microsoft Windows platform. While in Linux, there is available Quanta +, Bluefish, and Nvu.

Figure 13:10. Notepad text editor.

Directorate Technical Vocational Education

Page 114: Rekayasa perangkat lunak(Jilid3)

102 Sftware Engineering

Figure 13:11. Macromedia Dreamweaver.

Figure 13:12. Quanta on the Linux operating system

Figure 13:13. Bluefish on the Linux operating system

Directorate Technical Vocational Education

Page 115: Rekayasa perangkat lunak(Jilid3)

103 Sftware Engineering

13.4.2. General File Structure in HTML Language. The HTML is the language that inserted (embedded language) in the document with a specific cue called tags. Tag is the rules written in between the following sign < tag >. The browser will determine how to the display text or a document based on the tag is used.

The tag syntax follows the following general rules

1. Each tag has a specific name. Sometimes followed by options called attributes. Both the name and options must be within the sign <..>.

Example:<a href="/wiki/PHP" title="PHP"> PHP </ a>

In this example the tag <a> have a name attribute to the tag while <a> is the title and href. So that both the name tags and attributes must be in between <...> as in the example.

2. Most of the tags are paired. Writing for the pair of tag is as follows: <namatag> ....</ namatag>

Example:<TITLE>Paragraphs </ TITLE><strong> Bold Print </ strong>

Tag on the pair as in this example, the beginning tag is <TITLE> and </ TITLE> is the end tag. Note the sign / on the end tag.

3. A name tags and an attributes are not case sensitive. Writing <strong> Bold Print </ strong> to give the same results with <strong> Bold Print </ STRONG>.

4. The attributes of a tag placed after the name tag. If there are more than one attribute, space is used to separate them. The sequence of attribute is not important.

Example:<FONT SIZE=3> New Text </ FONT><FONT SIZE=5 FACE="verdana"> New Text </ FONT>

5. The value of the attribute is written after the sign =. In the previous example, the attribute of the tag FONT SIZE has value 5, while attribute FACE has a value "Verdana".

Directorate Technical Vocational Education

Page 116: Rekayasa perangkat lunak(Jilid3)

104 Sftware Engineering

6. If it is a single value attribute, we may directly write it after the sign =. If it is more than one attribute, we can then use the sign '... 'Or "...". In the example 4, it appears that the writing for the attributes SIZE is done without using sign "..", while in the FACE attribute uses the ".." to mark the word Verdana.

An HTML document in general consists of two parts, namely, Header and Body as shown in Figure 13.14.

Figure 13:14. The general structure of the HTML document.

● Header

This section usually contains various information on the document including the document title, its position in a set of web pages and its relation to other documents. This marked with the tag <head> .... </ head>. This tag does not have any attributes. In this tag, we can put some tags such as title tag and link tag. Please examine Figure 13.15 and 13.16.

Directorate Technical Vocational Education

Page 117: Rekayasa perangkat lunak(Jilid3)

105 Sftware Engineering

Figure 13:15. Header HTML document without the tag title.

Figure 13:16. HTML document header with the tag title.

● Body

Body is part of the HTML document where we put in the contents of the document. This section is started with tag <body> and end with </ body>. Whatever in between these two signs will be called the body content. The

Directorate Technical Vocational Education

Page 118: Rekayasa perangkat lunak(Jilid3)

106 Sftware Engineering

HTML document with the most simple may only contain one line or two lines of text only with out any format as shown in Figure 13.17. In a more complex document, body content may contain formatted text, images, tables or even a complex animation as shown in Figure 13.18.

Figure 13:17. The HTML document with a body of content simple.

Figure 13:18. The HTML document with a body of content that is more complex.

Directorate Technical Vocational Education

Page 119: Rekayasa perangkat lunak(Jilid3)

107 Sftware Engineering

13.4.3. Document Format There are many available HTML tags, whether it relates to the description of the document or associated with the display format of the document. Not everything will be discussed in this book. In the following, we will discuss some of the tags used in the normal format of the document view.

● Heading

A Heading is a set of words that became the title or subtitle in an HTML document. Heading is different from the tag <TITLE>. HTML offers six levels of headings, where the level of heading 1 (<H1>) is the largest and heading level 6 (<h6>) is the lowest. Figure 13.19 shows how the use the headings.

Figure 13.19. The use of headings.

● Paragraph

Paragraphs in HTML tags made with <p>. This tag will create a new blank line. The paragraphs content is enclosed by by <P> and </ P>. The position of paragraphs can be done with align attribute, followed by the desired position, namely, left, center for horizontally centered, and right to be right alligned as shown in Figure 13.20.

Directorate Technical Vocational Education

Page 120: Rekayasa perangkat lunak(Jilid3)

108 Sftware Engineering

Figure 13:20. The use of Paragraphs.

● Line Break

A line break is used to write text on the next line. The line break tags is made with a single <br>. This tag will create a new line without blank lines as the tag <p> as shown in Figure 13.21.

Figure 13:21. Tag <BR> and <P>.

● List

HTML provides 3 ways to make a list, name,

● Ordered list

Directorate Technical Vocational Education

Page 121: Rekayasa perangkat lunak(Jilid3)

109 Sftware Engineering

An Ordered list is used to create a list of where each section has a number sequentially. The Ordered list begins with <OL> tag and end with the </ OL> tag, while each part uses <li> tag without the closing tag. This tag by default will use sequence number, we can change it by via attribute TYPE. The allowed value of attribute TYPE is shown in table 13.1.

Table 13.1. TYPE list of attributes for Ordered list and Unordered list.

List Type Attribute Function

Ordered List TYPE=1 List sequence with number (1,2,3,...)

TYPE=I List sequence with capital roman number (I,II,III,...)

TYPE=i List sequence with small roman number (I,ii,iii,...)

TYPE=A List sequence woth capital letter (A,B,C,...)

TYPE=a List sequence with small letter (a,b,c,..)

Unordered List

TYPE=circle List sequence with circle.

TYPE=square List sequence with square

TYPE=disk List sequence with disk

Examples of Ordered list can be seen in Figure 13:22.

Figure 13:22. The use of Ordered List

● Unordered list

An unordered list used to create the list without sequence number, but by default using circle / bullet sign. These signs can be changed by changing the value TYPE attribute for the unordered list. The values of attributes that can be allowed 13.1 seen in the table. The unordered

Directorate Technical Vocational Education

Page 122: Rekayasa perangkat lunak(Jilid3)

110 Sftware Engineering

list begins with the tag <UL> and end with the tag </ UL>, while each part of the tag is used <li> Without closing tag. Examine the example in Figure 13.23.

Figure 13:23. The use of Unordered List.

Another type of list that is classified as Unordered list is a Directory list and the Menu list. Directory list is not numbered list and used to handle directory. The used tag is <DIR> ... </ DIR>. Menu list is generally used for the menu options. The used tag is <MENU> ... </ MENU>. Both of a Directory list or a Menu list are generated the same view with the Unordered list as shown in Figure 13.24 and Figure 13.24.

Figure 13:24. The use of Directory List

Directorate Technical Vocational Education

Page 123: Rekayasa perangkat lunak(Jilid3)

111 Sftware Engineering

Figure 13:25. The use of Menu List

● Definition list

A definition list created a list of definitions like the view on the dictionary, the definition of a term rather stick to the right. Three tide tag associated with the definition list is:

● <DL> ... </DL> to declare the location of list definition.● <DT> ... </DT> to declare the place for the term to be defined.● <DD> ... </DD> to declare where the definition of the term.

Example of definition list can be seen in Figure 13:26.

Figure 13:26. The use of the Definition List

Directorate Technical Vocational Education

Page 124: Rekayasa perangkat lunak(Jilid3)

112 Sftware Engineering

● Fonts

An HTML provides facilities set up of letter to be displayed in the document. This setting is done with the pair tag <FONT> and </ FONT>. This tag has several attributes to set the size, the type and color of the letters used.

● SIZE attribute to set the font size, where the value of 1 for the smallest letter and 7 for the largest letter.

● FACE attribute to set the desired type of letter, which a string value, such as the name of the font Arial, Tahoma and so forth.

● COLOR attribute to set the desired color of the text, which value can be filled with two-way with the name of the color in English, such as red, blue and green or with use the value of RGB (Red Green Blue) as FF000 to red.

Figure 13:27. The use of the font tag.

13.4.4. Adding Objects

● Horizontal Line

To beautify the display of HTML pages, we can add horizontal line with the tag <HR>. Tag <HR> have attributes, a SIZE, its determine the thickness of the lines, a WIDTH attribute to determine the width of the line, an ALIGN attribute to determine the location of the text in line, and NOSHADE attribute to set the line is not accompanied by a shadow. Figure 13.28 shows how <HR> tag is used.

Directorate Technical Vocational Education

Page 125: Rekayasa perangkat lunak(Jilid3)

113 Sftware Engineering

Figure 13:28. The use of Horizontal Line.● Image

A HTML document can be more attractive by include the image in the created web page. <IMG> Tag can be used to call and displays the image on the web page. Syntax <IMG> writing the tag is:

<img SRC="file_gambar" ALT="nama_alternatif">

SRC attribute is used to determine the source of the image files will be displayed. ALT attribute work to writing a substitute, when the image is not displayed.

Figure 13.29. The use of the tag image.

For a better picture better, IMG tag provides several attributes, among others:

● Attribute ALIGN to set the placement of text on the picture.● Attribute BORDER to frame the picture.● Attribute HEIGHT to set the width and height and width of the image.

Directorate Technical Vocational Education

Page 126: Rekayasa perangkat lunak(Jilid3)

114 Sftware Engineering

The following example shows the use of these attributes, attributes.

Figure 13:30. The use of IMG tag attributes.

Figure 13.30 shows the difference view as compared with Figure 13.29. Logo Linux is written in the middle of the picture because we using the attributes align with a middle value. While writing the logo Windows located at the top because we use align with the value top. Picture windows logo given a line by using the frame attribute border with a value of 2.

13.4.5. Table

Table in HTML may be created by using tag <TABEL> and closing tag </ TABLE>. This tag has some important part, as can be seen in the table below.

Table 13.2. Tags in Table

Tag Function

<CAPTION> ... </CAPTION> Set table title

<TH> ... </TH> Set column title

<TR> ... </TR> Create row in a table

<TD> ... </TD> Create a data cell

Examples of the tag usage in table is as follows.

Directorate Technical Vocational Education

Page 127: Rekayasa perangkat lunak(Jilid3)

115 Sftware Engineering

Figure 13:31. Simple Table.

Figure 13:31shows a simple table with two (2) columns and three (3) rows. Please note three (3) pairs of tag <TR> ... </TR>. There is no line on the table by default. We can add a line using the table border attributes as shown in Figure 13.32.

Figure 13:32. Table in a more complex format.

In Figure 13.32 shows a much better table than the previous figure. We add several attributes into the table, namely,

Directorate Technical Vocational Education

Page 128: Rekayasa perangkat lunak(Jilid3)

116 Sftware Engineering

● Attribute WIDTH is to set table width on the page. We may use percent (%), or pixels (px) as unit.

● Attribute BORDER is to provide a line on the table. The value for this attribute is starting from 0 for no line. The larger the number the thicker the line.

● Attribute BGCOLOR is to add a background color on the table.● Attribute CELLPADDING is to determine the distance between the text and the

left edge of a cell as shown in Figure 13.33.● Attribute CELLSPACING is to determine the distance to the edge of the cell in

the frame of the table as shown in Figure 13.33.

Figure 13.33. Cellpadding, cellspacing and border

Similar to a word processor, in HTML we can combine two or more cells into one cell. To merge line can be used a ROWSPAN attributes, and to merge the column can be use a COLSPAN attributes. Examples of their usage can be seen in Figure 13.34 and 13.35.

Directorate Technical Vocational Education

Page 129: Rekayasa perangkat lunak(Jilid3)

117 Sftware Engineering

Figure 13:34. Rowspan.

Figure 13.35. Colspan.

Directorate Technical Vocational Education

Page 130: Rekayasa perangkat lunak(Jilid3)

118 Sftware Engineering

The content of a cell in a table is not always text. It may be an image as shown in Figure 13.36.

Figure 13:36. Table with cells containing images. 13.4.6. Link between Documents

A Link is to open a web page or call or certain files. The Link is a important tag in HTML, because it is the the difference between a HTML document and another text documents. Links can be created by the anchor tag <A>. Anchor has several attributes, such as, HREF to create a link to the HTML document, and NAME to put a mark / name of a specific point in the same HTML document. Example the use of the anchor tag can be seen in Figure 13.37.

Figure 13.37. The use of anchor tag

Directorate Technical Vocational Education

Page 131: Rekayasa perangkat lunak(Jilid3)

119 Sftware Engineering

A HREF attribute can be used to call a page on a web that runs on the same system (on the same computer) as shown in Figure 13.37. In this case, we put / write the location of the page that we want to call. The HREF can also use to call another page outside the system or other sites on the Internet. Type the URL address of the site which we will call. To try it, type the following code using HTML text editor and then save the file with the extension. Htm.

LIST OF SEARCH ENGINE <menu> <li><a href="http://www.google.com/">Google</a> <li><a href="http://www.yahoo.com/">Yahoo</a> <li><a href="http://www.altavista.com/”>Altavista</a> </menu>


● The Web design technology is divided in several layers, such as, structural layer, presentation layer and behavioral layer.

● The content of static Web page contains data and information that is not changed. While in the dynamic web the contents of data and information may vary depending on client input.

● In developing a web page requires preparation of hardware, software and know how on web creation.

● HTML (hypertext markup language) is the language used to create a web page. It is inserted (embedded language) on the document with a certain mark called the tag.

● An HTML document in general, will consist of two parts, namely, Header and Body.

● An HTML provides a tags to describe and format a document.● An HTML page may include pictures, tables, sound, and other files.


1. What is the difference between static web and dynamic web ?2. Examine several sites on the Internet, then discover whether the opening page

is a static or a dynamic pages.3. Open a specific site, from the menu bar, choose View → Source. In the

window that appears, looked at the HTML codes. Search for which is a code for the document format, tables, pictures, and HTML elements of the other.

4. Create a HTML page as follows.

Directorate Technical Vocational Education

Page 132: Rekayasa perangkat lunak(Jilid3)

120 Sftware Engineering

5. Create a web page as follows.

Directorate Technical Vocational Education

Page 133: Rekayasa perangkat lunak(Jilid3)

121 Sftware Engineering


Figure 14.1. Google search page

Directorate Technical Vocational Education

Page 134: Rekayasa perangkat lunak(Jilid3)

122 Sftware Engineering

If you frequently surf the Internet, the above picture will likely familiar to you. The above figure is a search result of Google and can be classified as the dynamic web pages. It will be displayed in difference layout depending on your input.

This chapter discusses three (3) standard of competence, namely, create a basic dynamic web pages, make the web more dynamics and make an application programs on JSP based web. Merging of these three competency because of its proximity to the content of this basic competence. The sub-chapters may not directly refer to the basic competency, but more on order and the proximity of principal criticism. The summary is located at the end of the chapter followed by exercise questions. The exercise is prepared from an easy one to difficult questions. Each exercise is used to measure the ability of the competence. Prior to learn of the competence please remember the basic of computer operations , the operating system, basic programming algorithms, java programming, static web and HTML.


After learning this chapter, it is hoped that you'll be able to.

● Prepare the technical environment.● Creating the dynamic page.● Adding functions to the dynamic pages.● Testing a dynamic page● Understanding the concept of a web programming● Preparing the making of an application.● Introduced to scripting languages for web programming.● Recognizing the issues of web security.● Explaining the needs of the software for the JSP based web

application.● Explains JSP basics

14.1 THE BASIC OF DYNAMIC WEB The understanding of dynamic web has been discussed briefly in Chapter 13. In this chapter, we will learn a dynamic web.

Technical Environmental Requirements

There are important differences in the needs of the web development environment for static and dynamic web. In the previous chapter, you have learned that there are some

Directorate Technical Vocational Education

Page 135: Rekayasa perangkat lunak(Jilid3)

123 Sftware Engineering

needs for tools to create a static web, such as a personal computing devices, an operating system, a text editor or a software manufacturer web page, and a web browser. Some of these tools may be used for used for static web environment, butsome of the enhancements may also needed.

● Hardware

The development of dynamic web requires a higher hardware specifications than the static web. Generally, developers will do the creation of dynamic web on a computer as well as the role server and client. It is often required more than one computer, where one computer act as a server and the other as a client. The server technical specifications would be higher than client. Server needs a faster processor and larger main memory.

● Software

Use the server's Operating system version to be used on the development of dynamic web. Usually the operating system manufacturer will provide a version that is specially designed for a server. This version usually have a level of security and stability, which is higher than the desktop version. For example, there are Ubuntu Server, SuSe provides a version of Enterprise Server, and the other distros. In windows based, it is available on Windows NT, Windows Server 2000, Windows Server 2003 and the latest Windows Server 2008.

On the programming language in server side, the software requirement is different between static and dynamic web. The programming language should be installed for the web server to translate commands in certain language. For example, if we install only an Apache web server, we will not be able to run dynamic web page that written in PHP or JSP programming language. To run a dynamic web page we need to install a PHP or a Tomcat.

The developer tools to create a dynamic web are available. Although, some is relatively expensive. Some of these tools are Microsoft Visual Studio, Borland Delphi Studio, Adobe Dreamweaver, and others. These softwares can be used as HTML editor but also supports server programming languages such as ASP.Net, PHP, JSP, and ColdFusion. Some developer tools are also available for free, such as, NetBeans which fully supports JSP; Eclipse, which supports many programming languages; Komodo Editor, and others. Although it is free, the facilities are comparable with proprietary tools.

Another required software is the DBMS. This is usually due to the need for dynamic web database to store data. Personal DBMS, such as, Microsoft Access is not a good option for dynamic web as its security and performance are not suitable for dynamic web. An SQL-based database of the server, such as MySQL, Oracle, Microsoft SQL Server, and other options that are more suitable for dynamic web.

Directorate Technical Vocational Education

Page 136: Rekayasa perangkat lunak(Jilid3)

124 Sftware Engineering

Dynamic Web Programming

A web programming is an effort to create a web page using the web programming language. Web programming is also known as web development and sometimes known as web design. Web design is more focus on how to design an interesting page-view. Thus, web design puts more stress on the visual aspects of the web programming. While web programming is more focus on the logical aspects that occurs in the web pages. A web Programmer may also be a web designer. However, it is usually a separate job due to the differences in its emphasis.

To create good interactions, it is required some web programming model. The common programming model used is a client-side and server -side. Client and server in this case shows two different places. Servers are computers that act as a party that serves the request of data or information. While Client is computer where the users, who want to access to the server, request the data or information with a unique address. In general, interaction and exchange of data between the client and server in the Internet shown in Figure 14.2. In the Figure, it shows that all the process is done in the web-server (a server -side) while the client will only receive the process results from the web in HTML format.

Directorate Technical Vocational Education

Page 137: Rekayasa perangkat lunak(Jilid3)

125 Sftware Engineering

Figure 14.2. The exchange of data between the client and server.

The server will continuously run and will store all file / program for the web application. To be able to access server services, it will generally need a browser such as Internet Explorer (IE), Opera, Mozilla and Netscape.

Scripting language for Web Programming

As described above, there are two (2) web programming models such as a client-side and server-side. Programming language to create dynamic web also divided into two (2), namely, the client-side scripting and server-side script.

Programming language used to create applications on the client side is called as a client-side scripting. Client-side script that commonly used is JavaScript and VBScript. The main advantage of the client-side script is ia much faster process as compared to server-side script. This is because all user requests will be processed on the user's computer. However the biggest problem with the application of a client-side scripting is the code and data security as users may easily open and see the program code.

An example of a client-side script is:

● web applications such as a calculator, a date or a game.● Inspection events on the browser, if the mouse is clicked right then will appear

the needed information.● validation of fill out forms submitted by the user before sent to the server.

Programming language used to create applications on the server side is called as a server-side script. There are several advantages in the use of server-side script, namely:

● Security code. The scripts can not be read by users because it will be entirely stored and run on a web server. Client / user will receive only the processed result in HTML format only.

● Connection to the database. Ability connection with the database is the largest benefit from the server-side script. The information generated by the web the server becomes very dynamic no longer static pages. Information delivered to the user depending on what is desired by the users.

● User tracking. With server-side script, the user can know who accessing to web application using the session facilities.

Currently there are three (3) main technologies used in the server side script, namely, ASP (including ASP.Net), PHP, and JSP. JSP will be discussed on the other section of this chapter.

Directorate Technical Vocational Education

Page 138: Rekayasa perangkat lunak(Jilid3)

126 Sftware Engineering


ASP is not the programming language because the ASP is a engine of the server side script on the IIS. The Programming language is a VBScript. However, people often mention ASP only. This is the default server side script on a web server for Microsoft Windows. Like other Web programming languages, to mark that a code in a web page is a VBScript the tag is used as a bookmark. Here is a sample VBScript:

<html> <body> <% Response.Write("Hello World!") %> </body> </html> Atau sebagai berikut: <html> <body> <%= "Hello World!" %> </body> </html>

The code marked in between <% and%> is the VBScript code. VBScript is a language that is very similar with Visual Basic. It has been adjusted to the web environment. This document contains code that can be stored in the form of html or by extension .asp. However, the most important thing is the document should be placed on directory that can be read and executed by the IIS web server. ASP.Net is an advanced version of ASP, but the technology is very different. ASP.Net built based on the .NET technology developed by Microsoft. The language is not using VBScript anymore, it have been using the full capability of one of the languages in the .NET group, such as, Visual Basic.NET, C #, Visual J. With .NET technology, it allows HTML tags are replaced by full scripts written with languages. Net.


PHP is a programming language designed to create web page. PHP is short for PHP hypertext preprocessor. A rather strange abbreviation. Initially, PHP is the abbreviation of Personal Home Page created by Rasmus Lerdorf. PHP was created for the first timeto record the number of visitors homepage. PHP development can now be seen on www.php.net.

PHP is the most popular server-side language. The popularity due to the excess-benefits compared to similar language, such as Perl and CGI. PHP is able to cover the shortage in the programming language on the web. PHP is made for easy and quick execution. PHP may run in different web server, such as Apache, PWS, IIS, and so on. PHP may be run in different operating systems, such as, UNIX, Windows, Mac OS X

Directorate Technical Vocational Education

Page 139: Rekayasa perangkat lunak(Jilid3)

127 Sftware Engineering

and Linux. PHP is published for free. PHP source code can be freely downloaded. PHP is an embedded language that may be placed in HTML tag.

Preparation To Create a Dynamic Web Pages

Preparation prior to create a dynamic web pages are,

● Checking whether the web server has been correctly installed and properly running. In the Windows operating system, we can check whether a web server running or through the Service window. Open the Control Panel, then double click in the Administrative Tools icon. Select Service icon and double click on the icon until the window opens as in Figure 14.3.

Figure 14.3. Services window

In the window Services, look for the name of the service of your web server. If you using an IIS, search by using the name of the Internet Information Services on the column name. If you use an Apache, look for the name Apache. If there is nothing, it is possible that those services are not installed or not registered as a service. If there is, then checked whether it has been started, try to check then column status of whether or not already started. If not, click to start the service is run. After that, do a test by running the web browser you. Type in the address: http://localhost/ and press enter. In some web server configuration, calling the address may be must include the port

Directorate Technical Vocational Education

Page 140: Rekayasa perangkat lunak(Jilid3)

128 Sftware Engineering

number as http://localhost:8080/. If the home page of the web server you appear as shown in Figure 14.4. It means the web server has been able to works. But if it does not appear, or the message error means that the web server can not properly work..

Figure 14.4. Opera is calling the address of the server.

● Check whether the server programming language is installed and can be called by the web server. Examination can be done by checking the list of software that have been installed in the system. In Windows can be done with opened the Add Remove Programs such as in Figure 14.5. If the software programming language is installed, it will be registered on the following window.

Directorate Technical Vocational Education

Page 141: Rekayasa perangkat lunak(Jilid3)

129 Sftware Engineering

Figure 14.5. List of software installed on Windows.

● Prepare the storage file location of the program code. Files that contain code server-side script must be placed in the directory that can be read by a web server. For example, in some distribution Linux PHP files stored in the directory / usr / var / www / , on some distro are stored in the directory / svr / www /. In Microsoft Windows is fairly similar. This location can be changed by editing configuration files Apache Web Server (httpd.conf). Example locations of storage files can be viewed on PHP.

Directorate Technical Vocational Education

Page 142: Rekayasa perangkat lunak(Jilid3)

130 Sftware Engineering

Figure 14.6. Location directory that can read by the web server.

Developing and Testing Dynamic Web Pages

In this section we will try to make a simple dynamic page using a PHP language with the Apache web server. Open a text editor you (can use Notepad) and then type the code following. <?php echo “Hallo, ini PHP. Salam kenal ya..!!!”; ?>

Save the file named 21_1.php and store in a directory that can be accessed Apache web server. In this case, it is stored in the directory c: \ appserv \ www \ scripts \. Open a web browser and then you type in the page address: http://localhost:8080/scripts/21_2.php. Localhost is the name of the server and 8080 is the port where the Apache run. Note how to write the address and compare with the original location of the file. If all goes smoothly, you will find the display as in Figure 14.7.

Dynamic web pages must be called that way. Because the pages can only be run by a web server. In the static web page, you can double click on the file and a web browser displays the results. In a dynamic web page, it can not be done that way. Try double click on the dynamic web page files that you have made above. How is the output?

Directorate Technical Vocational Education

Page 143: Rekayasa perangkat lunak(Jilid3)

131 Sftware Engineering

Figure 14.7. Testing dynamic web page.


As a described above, the Java Server Pages (JSP) is a scripting language web programming for the server side such as PHP and ASP. JSP may be combined between the lines of HTML and functions from the JSP.

JSP technology is a web-based Java programming language and running on the Java Platform, and the technology is a J2EE (Java 2 Enterprise Edition). JSP technology provides an easier way to quickly and create web pages that display content dynamically. JSP technology is designed to facilitate and accelerate the creation of web based applications that work with a variety of web servers, application server, browser and development tool.

Java dan JSP

There are three (3) ways to use Java technology in a web environment, namely, applet, servlet and JSP. Java applet is a program that is inserted in the HTML pages using the tag <APPLET>. We can make a complex program by using the Java language and if you want to be shown in the web page, we save the program in the form of applets and

Directorate Technical Vocational Education

Page 144: Rekayasa perangkat lunak(Jilid3)

132 Sftware Engineering

paste them on HTML pages. These applets will be executed by the Java Virtual Machine (JVM) in your browser. Unfortunately, client computer is often not supported by the JVM, so that these applets can not be executed.

Servlet is a program written in the Java language that run on The web servers. In the servlet, the client computer does not need JVM, because all the code the program will be executed on the server side. The output will be delivered to the client browser is pure HTML. The Servlet is compiled into class form. Servlet will generally be able to increase the interactivity and the dynamic web page. The weakness of the servlet is the HTML page that contains the display must be made by using the language Java programming. This is difficult if we want to change the HTML part of it, because it means we must reopen the program code in java servlet.

JSP is a solution of the servlet. We do not need to code on the HTML text, but simply insert the code in the JSP HTML text. Thus, the static part of the HTML tags may be separated by JSP code. We can create a web page with static HTML / Web editor, and then inserted it with JSP code to create a web page dynamic.

Working Mechanism of JSP-based Web Applications

In general, JSP based web application will follow the mechanism as shown in Figure 14.8. Web pages that contain the JSP code will be sent to the web server. Then the web server will call the JSP translator software. The code then will be translated into a .Java extension by the JSP translator, this file will be compiled for the class. Results from this compilation will be executed and then the results will be presented to the web server to be on the client browser.

Figure 14.8. Working mechanisms with the JSP web application.

In a glimpse, the process looks cumbersome. In the beginning, indeed to displays a page that contains JSP feels slow because the process compilation should be done. But when the call for a second time then the pages will be very quick. This is because the compilation process does not need to be done again.

Directorate Technical Vocational Education

Page 145: Rekayasa perangkat lunak(Jilid3)

133 Sftware Engineering

Requirements and Configuration Software

To build a web applications based on JSP, the necessary software almost the same with other dynamic web. However, there is a specificity rather than ASP or PHP. This is because the difference in mechanism between the JSP with ASP or PHP. Except the software that has been mentioned in the beginning, these are the additional software needs for JSP.

● Java Development Kit (JDK). A JSP based on the Java language, then the JDK must be installed in the computer. JDK was discussed briefly in Chapter 8.

● Tomcat. Tomcat is the servlet container and the implementation of the JSP. It is required to simulate a personal computer into a web server. Tomcat is usually installed on the Apache web server, and called Apache Tomcat. This software can be freely downloaded from http://jakarta.apache.org.

● Integrated Development Environment (IDE) such as NetBeans or Eclipse. Although a JSP page can be create using a text editor, but it recommended to use a NetBeans to ease. Even at version 6.1. (can be freely downloaded at http://www.netbeans.org) other than to get the IDE we also get the web server and servlet container (Apache Tomcat), integrated as in Figure 14.9.

● We can use the application server that is very strong, namely SUN Java Application Server (Figure 14.10) is also integrated into the full package NetBeans.

In this book we will use many of the facilities for both NetBeans configuration and to create JSP pages.

Figure 14.9. NetBeans 6.1 integrated with Apache Tomcat.

Directorate Technical Vocational Education

Page 146: Rekayasa perangkat lunak(Jilid3)

134 Sftware Engineering

Figure 14.10. Admin Console Java Application Server.

After all correctly installed, then the second step is the configuration, particularly the location of the storage files. Open NetBeans, and then select the Tools menu and select Options. In the Options window as shown in Figure 14.11, select the tab Miscellaneous. Click Add to Directory Add to open the window Local Directory. Select a location and press OK. Click OK on the Options window to exit.

Directorate Technical Vocational Education

Page 147: Rekayasa perangkat lunak(Jilid3)

135 Sftware Engineering

Figure 14:11. Determination of the location of the storage files.

To test whether the JSP page can run, at the opening page of NetBeans, click the File menu and select New Project. New Project window as Figure 14:12 will be open. Choose Project on the select category of the Web and select the Web Application Projects. Click Next to continue to determine the name and location of the storage project as shown in Figure 14.13. Click Next to continue to determine the type and server settings as shown in Figure 14.14. In this section, we can choose whether to use the Apache Tomcat or GlassFish (Java Application Server). Click Finish to complete the configuration web application.

Directorate Technical Vocational Education

Page 148: Rekayasa perangkat lunak(Jilid3)

136 Sftware Engineering

Figure 14:12. Selection of type of project.

Figure 14:13. Determination of the name and location project.

Directorate Technical Vocational Education

Page 149: Rekayasa perangkat lunak(Jilid3)

137 Sftware Engineering

Figure 14:14. the type of server settings.

Once pressing Finish, you will be see the following display as shown in Figure in 14:15.

Figure 14:15. NetBeans work environment.

Directorate Technical Vocational Education

Page 150: Rekayasa perangkat lunak(Jilid3)

138 Sftware Engineering

Figure 14:16. Directory structure JSP application

Examine the Project windows, click Files and carefully read a directory structure in the directory JSP-01 in Figure 14.16. The directory structure of JSP application must follow the strict rules. Under the JSP-01, there is an important directory, it's the web directory. This directory where we save the file with the extension .JSP. Under the web directory, there are WEB-inf file directory. This directory should be the name is written like this, if not then the application will not be the way. This directory contains configuration files the important applications for the road web with JSP.

You try to run the JSP page that has been automatically opened by the NetBeans how to select the Run menu, then select Run Main Project. Program code that are made automatically by NetBeans is as follows:

<%-- Document : index Created on : Jun 21, 2008, 9:42:26 AM Author : Aunur R. Mulyarto --%> <%@page contentType="text/html" pageEncoding="UTF-8"%> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>JSP Page</title> </head> <body> <h2>Hello World!</h2> </body> </html>

Directorate Technical Vocational Education

Page 151: Rekayasa perangkat lunak(Jilid3)

139 Sftware Engineering

If your web browser displays the page as successful in 14.17 picture, it means you are ready to make an application with the JSP. Note the URL address , this page called by the address http://localhost:8080/JSP-01/. Because the files that we call the file is index.jsp, then we allowed to call the page without calling the file named. Configuration on the server has to make the server to recognize that the page with the name of the index is the first page.

Figure 14:17. Results execution JSP web page.


JSP tags provide four (4) categories, namely Directive, elements of scripting, comments, and the action. In this part we will not learn about the variable declarations, the structure of the control program, the class and method. This is because JSP is based on java, so that part is the same as what that you learn in the chapter on the Java programming (Chapter 8).


Directive is a set of tags that determine how the documents contains this directive will be processed. Directive used to send the JSP "Message" to the JSP container. Directive useful to setting the value of the global declarations such as class or method. Setting done by the Directive valid on all pages (only that page only). In general, Directive syntax is as follows:

<%@ nama_directive atribut1=”nilai1” atribut2=”nilai2” . . %>

Directorate Technical Vocational Education

Page 152: Rekayasa perangkat lunak(Jilid3)

140 Sftware Engineering

Directive on the JSP consists of three (3) types for different functions, namely,

● Page - used to define the attributes on JSP page. These attributes, such as, language, import, info errorpage, etc. To write it by using @ sign after JSP tag (<%), followed by the word page and page attributes.Example: <%@ page language=”java” %>

● Include - used to insert a file or import a class. To write it using @ sign after the JSP tags (<%) followed by word include and its attribute.Example: <%@ include file="/header.html" %>

● Taglib - used to define the tags made by programmers. To write it using @ sign after JSP tag (<%), Followed by the words taglib and attributes.Example: <%@ taglib uri = "http://jakarta.apache.org/taglibs/application-1.0" prefix="app" %>

Element Scripting

Scripting elements are used to combine the Java programming instructions into the web page. Instruction will be executed each time the page is requested. There are three types of scripting that is declaration, scriplet and expression.

● Declaration

JSP tags provide specifically intended to do declare a variables on page level. Variables such as this will be recognized along with page. Tag is called the tag declarations. Tag is as follows:


Example 14.1. The use of the tag declarations.

Type the following code and save with the name contoh14-1.jsp.

<html> <head> <title>Tag Deklarasi</title> </head> <body> <%! String baju; int harga = 60000; %>

Directorate Technical Vocational Education

Page 153: Rekayasa perangkat lunak(Jilid3)

141 Sftware Engineering

After the Declaration: <br>

<% baju = "John Mc Roe"; out.println("Merek baju : " + baju + "<BR>"); out.println("Harga baju : " + harga + "<BR>"); %> </body> </html>

Run the program, it will display the result with looks like in the Figure 14:18. In the example code, used of a tag declaration recognized the two variables, namely Shirt with string data type and Price with a data type int. Note also how to fill out, call and displays the contents of the variable return to the out.println statement.

Figure 14:18. The results of the execution of the tag declarations.

● Scriplet

Scriplet code is a set of Java programs run every time JSP page is called. In this section you can enter the code Java programs have you learned in Chapter 8. It is written in between tag <% code %>.

Example 14.2. Scriplet use of the tag.

<html> <head> <title>Contoh Println</title> </head>

Directorate Technical Vocational Education

Page 154: Rekayasa perangkat lunak(Jilid3)

142 Sftware Engineering

<body> <% out.print("Ini keluar dari tag scriplet"); out.print("Coba saja kalau tidak percaya”); %> </body> </html>

Save the file names that end with. JSP. Run the program code and check the results.

● Expression

Expression is a command line that is used to executed while displaying the web page. This expression is similar to call a function / method in Java. It is written in between tag <% = code%>

Example 14.3. The use of the tag expression.

Type the code below and then save the file as a JSP.

<%! //Deklarasi variabel int jmlUser=3; //Deklarasi method public String Hello(String nama) { return "Hallo " + nama; } %> <HTML> <HEAD> <TITLE>Contoh tag ekspresi JSP</TITLE> </HEAD> <BODY> <H3> <% for (int i=1; i<=jmlUser; i++) { //Contoh scriplets %> <i><%=Hello("User "+ i + "!")%> </i> <br> <%}%> </H3> </BODY> </HTML>

Run the code in the program. The appearance of the output will look like in the Figure 14:19.

Directorate Technical Vocational Education

Page 155: Rekayasa perangkat lunak(Jilid3)

143 Sftware Engineering

Figure 14:19. Results execution tag expression.


Comments are used to provide information on the JSP code. There three (3) types of comments that can be inserted in the JSP page, the content comments, JSP comments and scripting language comments.

● Content comments written content with the tag <- comment ->. Comments in this model does not display the output to the browser. But written in the HTML source.

● JSP Comments is a type of comments that appear only in the program code JSP. When the JSP code is compiled, the comments will be skipped and not participate in the compilation. Comments is written in this way <% - comment ->.

● Scripting language comments is similar to that used in Java (see again Chapter 8). Comments on this scriplet inserted. Example 14.3 uses one of the ways the script language comments. Note on the line which begins with the sign / /. The other way is with / * comment * /.


Action to support some different action. Almost similar to the scripting, the action will be executed each time a request. Important function of the action is the possible occurrence of transfer of control between the pages, support the use Java applets and allows JSP integrated with JavaBeans components. JSP tag action with the standard and custom tag. Tag is a standard tag defined in the JSP specification, while the

Directorate Technical Vocational Education

Page 156: Rekayasa perangkat lunak(Jilid3)

144 Sftware Engineering

custom tag is a new tag can be defined themselves. In part this is only discussed on the tag action standard. JSP standard tag action is as follows:

<jsp:useBean> <jsp:setProperty> <jsp:getProperty> <jsp:param> <jsp:include> <jsp:forward> <jsp:plugin>

In this book we will learn the use of the action standard forward and param. Forward Action is used to transfer control of a JSP page to another page on the local server. When the process progresses, the lines of code after the forward action on the JSP origin will not be processed again by JSP container. The process is moving to the destination page. To write it, use the tag <jsp:forward page="localURL" />. Forward action is usually used in conjunction with the Param warrant action. Examine the following following examples.

Example 14.4. The use of forward action for the operation log.

Create three files each named login.html, testlogin.jsp, and validlogin.jsp. The contents of each file is as follows.

File login.html<html> <head> <title>Login </title> </head> <body> <FORM ACTION="testlogin.jsp" METHOD="post"> Silakan masukkan nama dan password anda : <BR> Nama :<INPUT TYPE="text" NAME="nama"> <BR> Password :<INPUT TYPE="text" NAME="pass"> <BR> <INPUT TYPE="SUBMIT" VALUE="Login"> </FORM> </body> </html>

File testlogin.jsp <html> <head> <title>Test Login </title> </head>

Directorate Technical Vocational Education

Page 157: Rekayasa perangkat lunak(Jilid3)

145 Sftware Engineering

<body> <% String nama = request.getParameter("nama"); String pass = request.getParameter("pass"); if ((nama.equals("aunurrm")) && (pass.equals("arm"))) { %> <jsp:forward page='validlogin.jsp' > <jsp:param name='id' value='<%= nama %>' /> </jsp:forward> <% } else { %> <jsp:forward page='login.html' /> <% } %> </body> </html>

File validlogin.jsp <html> <head> <title>Login OK</title> </head> <body> <H3> Selamat <%=request.getParameter(“id”) %> <BR> Anda berhasil login<BR> </H3> </body> </html>

Run page login.html then you will get a view as Figure in 14:20. Fill cleanup name and password and press Login button. You will not get any results. Name and Your password will be lost. So repeatedly. Now enter in the name of 'aunurrm' and password 'arm' (without the quotation marks). Press the button Login, then you will get results as in Figure 14:21.

Directorate Technical Vocational Education

Page 158: Rekayasa perangkat lunak(Jilid3)

146 Sftware Engineering

Figure 14:20. Results login.html execution

Figure 14:21. Results if the username and password is correct.

In the above example, a login.html file is the file name to receive input and password. In this file we use the features on the HTML form. Form formed with the pair <FORM> tag and </ FORM>. Two main attribute of the FORM ACTION is often used and method.

● ACTION determine who will run the address and receive all entries in the

Directorate Technical Vocational Education

Page 159: Rekayasa perangkat lunak(Jilid3)

147 Sftware Engineering

FORM. If action is not mentioned, the information will be sent to address the same page with the FORM itself

● METHOD used to determine how information is sent to the address mentioned in the action. The values are commonly used are, GET and POST. POST to make the information will be sent separately with the address,GET while making the information will be sent to one address it's correct.

The above example is using the action = "testlogin.jsp" and the method is post. This means data on the form will be sent to the file testlogin.jsp in the same directory with the file login.html. A Testlogin.jsp is the second file that is used to capture input and then check whether the input is valid or not. Command request.getParameter used to receive input in accordance with the variable input set. For example request.getParameter ( 'name') means will capture the contents of the variable name of the file login.html. Contents of the name and pass will be entered in the variable string with the same name whether the names matched = 'aunurrm' and pass = 'arm'. If it is correct, then the action forward is taken, to deliver the content of which is defined in the action param variables, namely 'en' to file loginvalid.jsp. If not, the action forward also is taken but back to login.html. The third file only called if Condition and pass the name to be fulfilled. This file is also request.getParameter use to capture the variables' en '.

Security in Dynamic Web

Web is the most vulnerable to the threat and violations services in Internet. There are several ways that can be done by anybody that are not responsible for a site, among others:

● Exploiting the system bug. The attackers use the bug (errors) that resides in the operating system, web server, the web programming language, or other code that is installed in the computer server. If this is successful to be penetrated, then the attacker can take over the system overall.

● Exploiting a bug in the client applications. Sometimes we do not considering the bug in the client applications, for example, the features on the dangerous web browser that can be used as the springboard by the attackers.

● Access is not valid. To get this, done by accessing the access rights (user name and password) with a invalid way. By using the software specific, such as a password cracker, the attacker try to sniff what the users doing when they log on to web applications. After obtaining the rights access, they are using to access and disrupt the system not legitimate.

● Tapping the transmission of the information (eavesdropping). Information on the Internet as The car passed thatch in the streets. Its using a high level technique. Intercepting and extracting information that are transmitted between a web server and a web browser. Usually is data such as the secret password, account number, credit card numbers, and recording transactions online.

Directorate Technical Vocational Education

Page 160: Rekayasa perangkat lunak(Jilid3)

148 Sftware Engineering

● Assault with a Denial of Service (DOS). This form of attack more to the network environment, not in the system. This attack is aimed to paralyze a system by flooding the network with The traffic is very high and continuously exceed the capacity supported. This resulted in the network system stops working and can not be to serve the demand of users.

Figure 14:22. A DOS attack.

In general, there is no software to ensure one hundred percent secure. This is because the vulnerabilities always appear anywhere, it can cause any possible attack. However, there are several steps that can be used to reduce the risk of interference, among others:

● Running a secure server, for example, by not giving the opportunity for users to access through the shell, making facilities recording errors (the log) from the web server.

● Applying permissions or access rights in the directory and files in strictly (Chapter 4 open to learn more permissions). Permissions must also be applied in the configuration files of the web server.

● Writing program web application security. Often the error is not deliberate on the creation of a web application to make an application to become unsafe. It is recommended that the applications are examined and tested repeatedly to ensure a minimal rift security.

● Prevent and protect their information by encryption (encoding) that can not be read by sniffer.

● Control access to the web server. This is done to protect internal data that can not be accessed from outside. Can be done several ways, such as, restrict access based on IP address or domain limiting users based on a particular category, and others.

Directorate Technical Vocational Education

Page 161: Rekayasa perangkat lunak(Jilid3)

149 Sftware Engineering

Figure 14:23. Restricting access to a specific IP address.


● Web programming is a way to create a web pages using the web programming language (script).

● There are two web programming models, a client-side and server-side. ● A Programming language to create a dynamic web also divided into two,

namely, client-side scripting and server-side script.● To build a dynamic web application, is required in the preparation of web

servers, web programming language, dynamic web site storage, and application configuration.

● Java Server Pages (JSP) is a scripting language for web programming. It's a servers side and are running in the Java Platform.

● JSP tags provide four (4) categories, namely Directive, elements of scripting, comments, and the action.

● Web is the Internet services which has the most vulnerable to the threat and the violations, therefore the prevention and the web security is very important


1. Explain the requirements of hardware and software for creating dynamic web.2. What is the difference in the client-side scripting and server side script?3. Try to surf the Internet. Then in a few sites that you visit, the snow did it on the

page URL (see the section on the Address Bar web browser). Can you determine what is a web programming technology used?

4. Make a simple application using JSP to calculate the salary employees. Create a two-page, the page is the first to enter the input, the name of the month, the name of employees, the number of working hours in month and the hourly

Directorate Technical Vocational Education

Page 162: Rekayasa perangkat lunak(Jilid3)

150 Sftware Engineering

wage. Medium is the second page, to calculate the wages of employees (x hours of work a month wages per hour) at a time displays the names and salaries of the total obtained in the month.

5. Further develop problem no. 4, by adding the login page before entry page to enter the input. If someone successfully logged in, then enter the input page will appear, but if not it will lead to a new page, the page to register as a user.

Directorate Technical Vocational Education

Page 163: Rekayasa perangkat lunak(Jilid3)

151 Sftware Engineering


Anonymous. 2004. Guide to the Software Engineering Body of Knowledge (SWEBOK). The Institute of Electrical and Electronics Engineers, Inc.

Balter, A. 2006. Sams Teach Yourself Microsoft® SQL ServerTM 2005 Express in 24 Hours. Sams.

Bass, L., P. Clements, and R. Kazman. 2003. Software Architecture in Practice. 2nd Edition. Addison-Wesley.

Cormen, T.H. 2001. Introduction to Algorithm: Second Edition. The MIT Press.

Deek, FP., J.A.M. McHugh, and O.M. Eljabiri. 2005. Strategic software engineering : An Interdisciplinary Approach. Auerbach Publications.

den Haan, P., L. Lavandowska, S.N. Panduranga, and K. Perrumal. 2004. Beginning JSP 2: From Novice to Professional. Apress.

Dobson, R. 1999. Programming Microsoft Access 2000: The Developer’s Guide to Harnessing the Power of Access. Microsoft Press.

Felleisen, M, R.B. Findler, M. Flatt, and S. Krishnamurthi. 2001. How to Design Programs; An Introduction to Computing and Programming. The MIT Press.

Kak, A.C. 2003. Programming With Objects: A Comparative Presentation of Object Oriented Programming with C++ and Java. John Wiley & Sons, Inc.

Kaisler, S.H. 2005. Software Paradigm. John Wiley & Sons, Inc.

Kennedy, B. and C. Musciano. 2006. HTML & XHTML: The Definitive Guide, 6th Edition. O'Reilly.

Lafore, R. 1998. Data Structures & Algorithm in Java. Waite Group Press. 2nd Edition. Laurie, B and P. Laurie. 2001. Apache: The Definition Guide. O’Reilly and Associates, Inc.

Leffingwell, D. and D. Widrig. 2003. Managing Software Requirements: A Use Case Approach. 2nd Edition. Addison-Wesley.

Lischner, R. 2000. Delphi in a Nutshell. O’Reilly and Associates, Inc. Rekayasa Perangkat Lunak A1

Luckey, T. and J. Phillips. 2006. Software Project Management for Dummies. Wiley

Directorate Technical Vocational Education

Page 164: Rekayasa perangkat lunak(Jilid3)

152 Sftware Engineering

Publishing, Inc.

McConnel, S. 2003. Professional Software Development: Shorter Schedules, Higher Quality Products, More Successful Projects, Enhanced Careers. Addison-Wesley.

Meyer, B. 2000. Object Oriented Software Construction. 2nd Edition. ISE, Inc.

Musciano, C. and B. Kennedy. 2002. HTML and XHTML: The Definition Guide. 4th Edition. O’Reilly and Associates, Inc.

Navarro, A. 2001. Effective Web Design. 2nd Edition. SYBEX, Inc.

Powell, G. 2006. Beginning Database Design. Wiley Publishing, Inc.

Riordan, R.M. 2005. Designing Effective Database Systems. Addison Wesley Professional.

Robbins, J. N. 2006. Web Design in a Nutshell, 3rd Edition. O'Reilly.

Suehring, S. 2002. MySQL Bible. Wiley Publishing, Inc.

Taylor, D.A. 1998. Object Technology: A Manager’s Guide. Addison-Wesley.

Van Roy, P and S. Haridi. 2004. Concepts, Techniques, and Models of Computer Programming. The MIT Press.

Directorate Technical Vocational Education

Page 165: Rekayasa perangkat lunak(Jilid3)

153 Sftware Engineering


Abstraction Is simply cause from something complex by modeling class depends on problems.

Algorithm Step sort logical of solve problems in sort systematically.

Array Data structure save some same elements.

Attribute Characteristic to difference one entity to other entity.

Authentication Process check legality someone as user in a system (such as DBMS)

Basic Input/Output System (BIOS) Codes program run first time when computer on (booting)

DatabaseData collection in connect each else other, store in hardware computer and use software to manipulation.

Command Line Interface (CLI) Between face user with command text model.

Compiler Translation language program in top level to machine language for all code program. Process called compilation.

Component Object Model (COM) Infrastructure available by Visual Basic to access objects or other controls as long has between face. Constraint Restriction/limitation problem

Control Activities monitoring and evaluating and feedback to make sure whether system in good work or not.

Counter Variable number that use in algorithm structure for repetition.

Directorate Technical Vocational Education

Page 166: Rekayasa perangkat lunak(Jilid3)

154 Sftware Engineering

Database Management System (DBMS) Special software use for management database.

Disk Operating System (DOS) One of old operation system in CLI base.

Electronic That science about low-tension electric current with operation by electric current control or particle ion electric in an equipment.

Entity Individual for representative extension that make different from other.

Extensible Hypertext Markup Language (XHTML) HTML lat version (4.01) that rewrite by rule strict and tight with term XML

Extensible Markup Language (XML) Rules to make markup language.

Feedback Data about system performance

Flowchart Scheme/chart which show flow in a logical program.

IndicationSignal for a problem.

Logical gate Blocks formation from electronic hardware.

Graphical User Interface (GUI) Between user face by graphics model.

Identifier Name of variable or constant

Computer scienceA systematic study in algorithm process, explain and transfer information.

Inheritance Principe from characteristic parents to children or generation which apply in classes.

InitializationFirst instruction to variable or expression program.

Directorate Technical Vocational Education

Page 167: Rekayasa perangkat lunak(Jilid3)

155 Sftware Engineering

Input Elements into system.

Integrated Development Environment (IDE) Software to help easily make computer application.

Interpreter Translate language program at top level to machine language one by one lines, read and direct translatability.

Cardinality Total max entity in an association entity and can relation with others entity association.

Constanta Variable with constant value data and can not change.

Loop Repletion process command.

ProblemDifference between actual situation and hopeful situation or difference between present condition with target or aim wish.

Model Make a simple system or Imitation a simple system.

Multi-tasking Task operation system to run duties/application with the same time.

Multi-user Task operation system to run by different user with the same time.

Output Move elements result from change process to aim wish.

Solve ProblemA process where situation analyze then make solutions if has problem by define, less or remove or cut problem.

Object Oriented Programming – OOP

Paradigm program where use object and integrate to make application and computer program.

Web programA way to make web page by language web program (script)

Directorate Technical Vocational Education

Page 168: Rekayasa perangkat lunak(Jilid3)

156 Sftware Engineering

SoftwareAll instruction where use to process information.

Permissions A proses to determine what user can do to a system.

Pointer Variable that keep address in memory computer.

Polymorphism Ability objects to has more than one form.

Programmer A person who work to make computer program.

Procedure • Instruction that user need to process information. • Commands that a part of big program and has function to certain job.

ProcessChange or transformation input to output Prototyping Approach software development in directly to demonstrate how software or components software work in environment before construction actual steps do.

Pseudocode The way write of algorithm with codes similar language program.

Query Request or search certain data in database.

Record Data line from table.

Software Engineering A discipline science that explain all aspect software production, start from first step that analyze user need, to make sure specification user need, design, codes, test until maintain system after use.

RelationshipConnect in between entities.

SystemElements which interaction to get certain goals.

Directorate Technical Vocational Education

Page 169: Rekayasa perangkat lunak(Jilid3)

157 Sftware Engineering

Database SystemElements such as database, software, hardware, and user which interaction each other to get certain goals that is data organization.

SolutionEnd part or output from solve problem process.

Stored procedure Cut of Code program which can receive parameter input and has result one or more parameter output and use for operation database.

Structured Query Language (SQL) Query language structure to manage database.

Strategic solve problem Method or approach which use by someone when get problem.

Structure algorithm The way or steps to make an algorithm.

Data type Data type which can manage by computer to facility need in computer program.

Trigger Specific type from stored procedure which will execute when get problem.

Variable Place where we can fill-in or make empty value and re-call if need in a program.

View Table virtual which contain base on query and do in database.

Web browser Software that function to translate HTML codes become view as we want.

Web dynamism Web pages which contain and information change as want by user.

Web server Software which do to serve question client to certain web pages.

Web statics Web pages which contain and information not change.

Directorate Technical Vocational Education

Page 170: Rekayasa perangkat lunak(Jilid3)

158 Sftware Engineering

Directorate Technical Vocational Education

Page 171: Rekayasa perangkat lunak(Jilid3)

159 Sftware Engineering


Following is the list of important Internet sites used as references for the book.

Address Comments

http://www.apache.org Official site of Apache Web server. This site provides the source code of Apache for various operating systems as well as a complete documentation.

http://www.borland.com Official site of Borland. Borland is a software house that produces Borland Delphi, Borland Jbuilder, Turbo Pascal, Turbo Delphi, Borland C++ etc.

http://www.debian.org Official site of Debian Linux.

http://www.eclipse.org Official site of Eclipse Project, an integrated development software that supports many programming language.

http://www.google.com Google search engine.


Indonesian site the provides documentation on various section of computer science.

http://www.javasoft.com Official documentation and online information on Java programming supported by Sun Microsystem.


Indonesian site that provides iso of various linux distribution to be freely downloaded. In addition, this site is mirroring various linux distribution and application runs on linux.

http://www.linuxdoc.org This site provides Linux documentations that can be freely downloaded.


Official site of Microsoft. A company that produce Windows operating systems, IDE Microsoft Visual Studio, Microsoft Office, Microsoft SQL Server, etc.

://www.mysql.com Official site of MySQL Database Software. This site provides the installation file for MySQL for various platform. In addition, it provides a complete documentation of MySQL.


Official site of IDE NetBeans, a Java development software.

http://www.php.net Official site for PHP programming language and interpreter. This site provides the source code and installtion file of PHP for various operating systems. In

Directorate Technical Vocational Education

Page 172: Rekayasa perangkat lunak(Jilid3)

160 Sftware Engineering

addition, it provides a complete documentation of PHP.

http://www.w3.org Official site of The World Wide Web Consortium (W3C). W3C is a consortium that sets the standard and Web related technology, especially, on HTML, XML, CSS, XHTML etc. The documentations on the technology may be downloaded from this site.

Directorate Technical Vocational Education

Page 173: Rekayasa perangkat lunak(Jilid3)

161 Sftware Engineering


IsNumeric(expression)This function use to test whether an expression get numeric result or not. The value return is Boolean.

IsEmpty(expression) Function to check whether an expression already fill-in value or not. The value return is Boolean.

IsNull (expression) Function to check whether an expression has not valid data, usually use to check contain field recordset.

IsArray (varname) Function to check whether a variable is an array.

IsDate (expression) Function to check whether an expression can conversion to date.

IsError(expression) Function to check whether an expression is error value.

IsObject(expression) Function to check whether an expression use to an OLE Automation object.. IsMissing(argname) Function to check whether an argument optional to procedure, it pass or not.

CBool(expression) Conversion an expression to Boolean.

CByte(expression) Conversion an expression) to Byte.

CCur(expression) Conversion an expression to Currency.

CDate(date) Conversion an expression to date.

CDbl(expression) Conversion an expression to Double.

Directorate Technical Vocational Education

Page 174: Rekayasa perangkat lunak(Jilid3)

162 Sftware Engineering

CInt(expression) Conversion an expression to Integer.

CLng(expression) Conversion an expression to Long.

CSng(expression) Conversion an expression) to single.

CStr(expression) Conversion an expression to string.

CVar(expression) Conversion an expression to Variant.

Asc(string) Function to show code character from first letter to string.

Chr(charcode) Function to show character from one code to character code.

Format(expression)[, format[, firstDayFromSunday[,sundayFirstFromYear]]]) Formating an expression base on expression format/

Hex(number) and Oct(number) Show string which represent Octal or Hexa from number.

Str(number) Show string which represent number.

Val(string) Show number from string.

Now Return a Variant (Date) which show date and time base on computer system.

Time Return time the present system.

Timer Return number which show total second since midnight.

Date Return date the present system.

Directorate Technical Vocational Education

Page 175: Rekayasa perangkat lunak(Jilid3)

163 Sftware Engineering

Time = Time and Date = Date Arrange time or date system: Run system by Microsoft Windows 95, date need from 1 Jan 1998 until 31 Dec

2099. Run system by Microsoft Windows NT, date need from 1 Jan 1980 until 31 Dec


Hour(time), Minute(time) and Second(time) Return a Variant (Integer) such as number 0 s/d 23 for jam, 0 s/d 59 for minutes, and 0 s/d 59 for second.

Day(date), Month(date), and Year(date)

Return a Variant (Integer) such as number 1 s/d 31 for month, 1 up to12 for month, and year.

Directorate Technical Vocational Education