This document contains code for an account management system with functionality for user login validation, account retrieval from a database, account updating in the database, and form submission for login and updating accounts. It includes Java classes for business logic (CheckLoginBO), data access (ShowUserDAO, UpdateDAO, InsertDAO), and servlets to handle form submission and database operations.
This document contains 33 multiple choice questions related to Java Database Connectivity (JDBC). Some of the key topics covered include:
- The differences between JDBC and ODBC
- The different types of JDBC drivers
- Using CallableStatement to execute stored procedures
- Retrieving and manipulating result sets
- Transaction control methods like commit and rollback
- Database metadata access through the Connection object
The questions test understanding of core JDBC concepts like executing queries, retrieving and updating result sets, using prepared statements, and working with stored procedures.
This document contains code for an account management system with functionality for user login validation, account retrieval from a database, account updating in the database, and form submission for login and updating accounts. It includes Java classes for business logic (CheckLoginBO), data access (ShowUserDAO, UpdateDAO, InsertDAO), and servlets to handle form submission and database operations.
This document contains 33 multiple choice questions related to Java Database Connectivity (JDBC). Some of the key topics covered include:
- The differences between JDBC and ODBC
- The different types of JDBC drivers
- Using CallableStatement to execute stored procedures
- Retrieving and manipulating result sets
- Transaction control methods like commit and rollback
- Database metadata access through the Connection object
The questions test understanding of core JDBC concepts like executing queries, retrieving and updating result sets, using prepared statements, and working with stored procedures.
The document defines classes for different shapes including Circle, Square, Triangle, Sphere, Cube, and Tetrahedron. A Main class initializes instances of these shapes and stores them in arrays. It then displays information about each shape such as name, area, volume by looping through the arrays.
An algorithm must be precise, unambiguous, and end with the correct solution in all cases. Pseudocode uses a structured English description to outline the steps of an algorithm or computer program. It helps designers and programmers develop code by providing a detailed template. Coding conventions establish guidelines for writing readable code through standards for indentation, comments, naming, and other aspects of programming. Following conventions helps programmers understand new code quickly and maintain software efficiently.
2. Relational model basics
Data is viewed as existing in two dimensional tables known as
relations
A relation (table) consists of unique attributes (columns) and
tuples (rows)
Tuples are unique
Sometimes the value to be inserted into a particular cell may
be unknown, or it may have no value. This is represented by a
null
Null is not the same as zero, blank or an empty string
Relational Database: Any database whose logical organization
is based on relational data model.
RDBMS: A DBMS that manages the relational database
3. What is RDBMS?
Relational Database: Any database for which
the logical organization is based on relational
data model.
RDBMS: A DBMS that manages the relational
database.
An RDBMS is a type of DBMS that stores data
in the form of related tables.
4. Concepts in RDBMS
Common concepts in RDBMS:
Data is layout as set of relational-records
A relation describe a table.
Columns are attributes.
Rows (tuples) describe an entity.
A table has set of attributes called a key, the key
specify an unique entity.
5. Concepts in RDBMS
Kh叩i ni畛m
Ngh挑a
Quan h畛
M畛t b畉ng
Tuple
M畛t hng ho畉c m畛t b畉n ghi quan h畛
Thu畛c t鱈nh
M畛t tr動畛ng ho畉c m畛t c畛t trong quan h畛
Cardinality c畛a m畛t
quan h畛
S畛 hng trong m畛t quan h畛
B畉c c畛a quan h畛
S畛 thu畛c t鱈nh trong m畛t quan h畛
Mi畛n gi叩 tr畛 c畛a thu畛c
t鱈nh
T畉p c叩c gi叩 tr畛 c坦 th畛 l動u tr畛 trong thu畛c t鱈nh
Kh坦a ch鱈nh c畛a quan
h畛
M畛t thu畛c t鱈nh ho畉c m畛t t畉p c叩c thu畛c t鱈nh m gi叩 tr畛 c畛a
n坦 x叩c 畛nh duy nh畉t c叩c b畉n ghi trong quan h畛
Kh坦a ngo畉i
M畛t thu畛c t鱈nh ho畉c m畛t t畉p c叩c thu畛c t鱈nh trong quan h畛
R1 m n坦 ch畛 ra m畛i quan h畛 c畛a R1 v畛i quan h畛 R2
C叩c thu畛c t鱈nh kh坦a ngo畉i trong R1 ph畉i ch畛a c叩c gi叩 tr畛
so kh畛p v畛i c叩c gi叩 tr畛 t動董ng 畛ng trong quan h畛 R2
7. Entities & Tables
An entity may be a person, a car, an event, that it
may define.
An entity has some characteristics as attributes, each
entity has a name.
A table contain a group of entities called set of
entities.
A table is called a relation, rows are tulpes, columns
are attributes.
10. Data modelling
Study of basic properties and interrelationships among data items to properly
represent them in the basic data structures of
a database
Two popular techniques: ER modeling and
Normalization
12. Process of ER modelling
Real
world
Requirement
collection &
Analysis
Specification
Survey
Interview
Collect requirement
Analisys
Requirement
database
Conceptual
design
Conceptual
model
ER Modelling
..
Modelling
Design
13. Process of ER modelling
FU
Ti li畛u m担 t畉
bi to叩n
Tr動畛ng FU c坦 nhu c畉u x但y d畛ng m畛t h畛
th畛ng th担ng tin qu畉n l箪 ph畛c v畛 ho畉t 畛ng
d畉y v h畛c trong tr動畛ng
Ph嘆ng QLSV: qu畉n l箪 畛a ch畛 v c叩ch li棚n l畉c c畛a t畛ng
sinh vi棚n, m畛i ph畛 huynh khi c畉n thi畉t.
- C畉n bi畉t c叩c sinh vi棚n lm l畛p tr動畛ng
- Sinh vi棚n 動畛c ph但n chia vo c叩c l畛p
Ph嘆ng Gi叩o v畛: qu畉n l箪 i畛m c畛a sinh vi棚n v vi畛c gi畉ng
d畉y c畛a gi叩o vi棚n.
- M畛t sv c坦 th畛 h畛c nhi畛u m担n h畛c, m畛i m担n h畛c ch畛
動畛c h畛c m畛t l畉n.
- M畛t gi叩o vi棚n c坦 th畛 d畉y nhi畛u m担n h畛c, m畛t m担n h畛c
ch畛 動畛c d畉y b畛i m畛t gi叩o vi棚n.
- M畛i m担n h畛c c坦 th畛 c坦 m担n h畛c tr動畛c
Ph嘆ng Hnh ch鱈nh: qu畉n l箪 th担ng tin gi叩o vi棚n, 畉m nhi畛m
vi畛c thanh to叩n l動董ng cho gi叩o vi棚n.
14. ER Modelling
Qu叩 tr狸nh thi畉t k畉 CSDL b畉t 畉u t畛 vi畛c ph但n t鱈ch
Th担ng tin c畉n l動u tr畛 trong CSDL
Quan h畛 gi畛a c叩c thnh ph畉n c畛a th担ng tin => M担 h狸nh ER
(S董 畛 ER)
ER th動畛ng 動畛c d湛ng nh動 c担ng c畛 k畉t n畛i gi畛a nh
thi畉t k畉 CSDL v NSD.
ER l m担 h狸nh ng畛 ngh挑a 畛 bi畛u di畛n ng畛 ngh挑a
c畛a d畛 li畛u trong th畉 gi畛i th畛c.
ER cho ph辿p m担 t畉 l動畛c 畛 kh叩i ni畛m c畛a m畛t t畛
ch畛c m kh担ng ch炭 箪 畉n hi畛u qu畉 ho畉c thi畉t k畉
CSDL v畉t l箪.
24. Quan h畛 - T畉p quan h畛 (1)
Quan h畛 - Li棚n k畉t (Relationship)
S畛 k畉t h畛p gi畛a m畛t s畛 th畛c th畛 thnh 1 th畛 th畛ng nh畉t;
ph畉n 叩nh s畛 t動董ng quan t畛 nhi棚n c畛a d畛 li畛u.
L quan h畛 v畛 DL gi畛a m畛t ho畉c nhi畛u t畉p th畛c th畛
Quan h畛 bao gi畛 c滴ng c坦 2 chi畛u.
VD: sinh vi棚n L棚 Na h畛c m担n CSDL1 => quan h畛 gi畛a t畉p
th畛c th畛 SV v t畉p th畛c th畛 MN H畛C.
T畉p c叩c quan h畛 (Relationship set)
L m畛t t畉p c叩c quan h畛 c湛ng ki畛u.
VD: sinh vi棚n L棚 Na h畛c m担n CSDL1; sinh vi棚n Hoi Nam
h畛c m担n Anh 3; => t畉p c叩c quan h畛 h畛c gi畛a t畉p th畛c
th畛 SV v t畉p th畛c th畛 MN H畛C
25. Quan h畛 - T畉p quan h畛 (2)
M畛t th畛c th畛 thu畛c t畉p th畛c th畛 (1) thay 畛i => s畉
thay 畛i c叩c th畛c th畛 thu畛c t畉p th畛c th畛 (2) m c坦
quan h畛 v畛 m畉t d畛 li畛u v畛i (1)
X叩c 畛nh m畛i li棚n h畛 d畛a vo
K畉t qu畉 kh畉o s叩t th畛c t畉
Ng畛 ngh挑a c畛a bi to叩n c畉n m担 h狸nh h坦a
T棚n c畛a T畉p quan h畛 (li棚n k畉t) l 畛ng t畛 m ph畉n 叩nh
箪 ngh挑a c畛a m畛i li棚n h畛 坦.
VD1. Sinh vi棚n An h畛c m担n h畛c CSDL1 => m畛i li棚n h畛 gi畛a t畉p
th畛c th畛 Sinh vi棚n v M担n h畛c l h畛c
VD2. H坦a 董n HD0123 c畛a kh叩ch hng Xu但n => m畛i li棚n
h畛 gi畛a H坦a 董n v Kh叩ch hng l thu畛c v畛
26. T畉p quan h畛 trong FU
Sinh vi棚n & M担n h畛c
Sinh vi棚n A h畛c m担n h畛c X
M担n h畛c X 動畛c h畛c b畛i sinh vi棚n A v sinh vi棚n C
M担n h畛c & Gi叩o vi棚n
M担n h畛c Y do gi叩o vi棚n E d畉y
Gi叩o vi棚n E 達 d畉y m担n Z, m担n V, m担n W
Sinh vi棚n & L畛p
Sinh vi棚n A thu畛c v畛 l畛p T
L畛p T ch畛a c叩c sinh vi棚n A, B, C
Sinh vi棚n & Sinh vi棚n
Sinh vi棚n A l ch畛 huy c畛a sinh vi棚n B v C
Sinh vi棚n B, C do sinh vi棚n A qu畉n l箪
M担n h畛c & M担n h畛c
M担n h畛c Y ph畉i hon thnh tr動畛c m担n Z
M担n h畛c Z ph畉i h畛c sau m担n Y v m担n U
27. M畛t s畛 kh叩i ni畛m c畛a quan h畛
B畉c/Ng担i c畛a quan h畛 (degree)
董n ph但n, Nh畛 ph但n, Tam ph但n,
L畛c l動畛ng tham gia quan h畛 (cardinality)
11, 1-1-1, 1-n, n-1, 1-1-n, 1-n-n
N-n, n-n-n,
Rng bu畛c tham gia quan h畛 ...
T湛y ch畛n
B畉t bu畛c
=> C叩c kh叩i ni畛m tr棚n quy畉t 畛nh vi畛c ch畛n ki畛u v lo畉i
th畛c th畛 no
28. B畉c c畛a quan h畛 (Degree)
L s畛 c叩c t畉p th畛c th畛 tham gia vo quan h畛 (li棚n k畉t).
B畉c c畛a quan h畛 c坦 th畛 l 董n ph但n, nh畛 ph但n, tam ph但n,
n ph但n (1, 2,..., n t畉p th畛c th畛)
Quan h畛 董n ph但n (Unary)
Quan h畛 nh畛 ph但n (Binary)
Quan h畛 tam ph但n (Tenary)
29. L畛c l動畛ng tham gia quan h畛 (1)
L畛c l動畛ng tham gia quan h畛 th畛 hi畛n s畛 c叩c
t畉p th畛c th畛 c坦 quan h畛 v畛i nhau trong m畛t
m畛i quan h畛
V畛i quan h畛 nh畛 ph但n (binary relationship) th狸
l畛c l動畛ng ph畉i l m畛t trong s畛 c叩c ki畛u
sau:
1 1, 1 n, n 1, n n
畛i v畛i c叩c quan h畛 kh叩c, l畛c l動畛ng 動畛c
x叩c 畛nh t動董ng t畛.
30. L畛c l動畛ng tham gia quan h畛 (2)
Quan h畛 gi畛a ph嘆ng ban v ng動畛i qu畉n l箪
Quan h畛 gi畛a l畛p C担ng ngh畛 v Sinh vi棚n
Quan h畛 gi畛a m担n h畛c v Sinh vi棚n
33. Converting strong entity types
Each entity type becomes a table
Each single-valued attribute becomes a column
Derived attributes are ignored
Composite attributes are represented by
components
Multi-valued attributes are represented by a
separate table
The key attribute of the entity type becomes the
primary key of the table
34. Entity example
Here address is a composite
attribute
Years of service is a derived
attribute (can be calculated from
date of joining and current date)
Skill set is a multi-valued
attribute
The relational Schema
Employee (E#, Name, Door_No, Street, City, Pincode, Date_Of_Joining)
Emp_Skillset( E#, Skillset)
35. Converting weak entity types
Weak entity types are converted
into a table of their own, with the
primary key of the strong entity
acting as a foreign key in the table
This foreign key along with the key
of the weak entity form the
composite primary key of this table
The Relational Schema
Employee (E# ,.)
Dependant (Employee, Dependant_ID, Name, Address)
36. Converting relationship
The way relationships are represented depends
on the cardinality and the degree of the
relationship
The possible cardinalities are:
1:1, 1:M, N:M
The degrees are:
Unary
Binary
Ternary
37. Converting ERD to relations (1)
Qui
t畉c 1: Bi畉n 畛i m畛t ki畛u th畛c th畛 thnh
m畛t quan h畛.
畛i v畛i ki畛u th畛c th畛 th担ng th動畛ng (regular entity
type): kh坦a c畛a quan h畛 l kh坦a c畛a ki畛u th畛c th畛.
Thu畛c t鱈nh c畛a quan h畛 l thu畛c t鱈nh c畛a ki畛u th畛c th畛.
Quan h畛 ch畛 ch畛a c叩c thu畛c t鱈nh thnh ph畉n c畛a thu畛c
t鱈nh ph畛c h畛p.
Quan h畛 kh担ng ch畛a c叩c thu畛c t鱈nh a tr畛.
38. Converting ERD to relations (2)
CUSTOMER entity type with
simple attributes
CUSTOMER relation
Bi畉n 畛i ki畛u th畛c th畛 th担ng th動畛ng
39. Converting ERD to relations (3)
CUSTOMER entity type with
composite attribute
CUSTOMER relation with address detail
Bi畉n 畛i thu畛c t鱈nh ph畛c h畛p
40. Converting ERD to relations (4)
Qui
t畉c 2: Bi畉n 畛i thu畛c t鱈nh a tr畛 thnh
m畛t quan h畛.
Quan h畛 ch畛a kh坦a c畛a ki畛u th畛c th畛 v thu畛c t鱈nh a
tr畛.
Kh坦a c畛a quan h畛 g畛m kh坦a c畛a ki畛u th畛c th畛 v thu畛c
t鱈nh a tr畛.
41. Converting ERD to relations (5)
Multivalued attribute becomes a
separate relation with foreign key
1tomany relationship between original
entity and new relation
Convert Multivalue attribute
42. Converting ERD to relations (6)
Qui
t畉c 3: Bi畛u di畛n m畛i li棚n k畉t 1-ng担i ho畉c
2-ng担i c坦 l動畛ng s畛 m畛t-m畛t.
畉t kh坦a c畛a ki畛u th畛c th畛 b棚n ph鱈a b畉t bu畛c v c叩c
thu畛c t鱈nh c畛a m畛i li棚n k畉t vo quan h畛 c畛a ki畛u th畛c
th畛 b棚n ph鱈a t湛y ch畛n.
43. Converting ERD to relations (7)
EMPLOYEE entity with Manages
relationship
EMPLOYEE relation with recursive foreign
key
Convert Unary relationship one to one
44. Converting ERD to relations (8)
Convert binary relationship one to one
45. Converting ERD to relations (9)
Qui
t畉c 4: Bi畛u di畛n m畛i li棚n k畉t 1-ng担i ho畉c
2-ng担i c坦 l動畛ng s畛 m畛t-nhi畛u.
畉t kh坦a c畛a ki畛u th畛c th畛 b棚n ph鱈a m畛t v c叩c thu畛c
t鱈nh c畛a m畛i li棚n k畉t vo quan h畛 c畛a ki畛u th畛c th畛 b棚n
ph鱈a nhi畛u.
46. Converting ERD to relations (10)
EMPLOYEE entity with
Manages relationship
EMPLOYEE relation with
recursive foreign key
Convert Unary relationship one to many
47. Converting ERD to relations (11)
Note the mandatory one
Again, no null value in the
foreign keythis is because of
the mandatory minimum
cardinality
Convert Binary relationship one to many
48. Converting ERD to relations (12)
Qui
t畉c 5: Bi畉n 畛i m畛i li棚n k畉t 1-ng担i ho畉c 2ng担i c坦 l動畛ng s畛 nhi畛u-nhi畛u thnh m畛t
quan h畛.
Quan h畛 ch畛a c叩c kh坦a c畛a c叩c ki畛u th畛c th畛 tham gia
vo m畛i li棚n k畉t.
Kh坦a c畛a quan h畛 g畛m c畉 hai kh坦a c畛a hai ki畛u th畛c
th畛.
Thu畛c t鱈nh c畛a quan h畛 l thu畛c t鱈nh c畛a m畛i li棚n k畉t.
49. Converting ERD to relations (13)
Bill-of-materials
relationships (M:N)
ITEM and COMPONENT
relations
Convert Unary relationship many to many
50. Converting ERD to relations (14)
The Supplies relationship
will need to become a
separate relation
Composite primary key
New intersection
relation
Foreign key
Foreign key
Convert Binary relationship many to many
51. Converting ERD to relations (15)
Qui
t畉c 6: Bi畉n 畛i m畛i li棚n k畉t 3-ng担i thnh
m畛t quan h畛.
Quan h畛 ch畛a ba kh坦a c畛a ba ki畛u th畛c th畛 tham gia
vo m畛i li棚n k畉t.
M畛i li棚n k畉t c坦 bao nhi棚u ki畛u th畛c th畛 b棚n ph鱈a m畛t
th狸 quan h畛 c坦 b畉y nhi棚u kh坦a: 畛i v畛i m畛t ki畛u th畛c
th畛 b棚n ph鱈a m畛t th狸 kh坦a c畛a quan h畛 g畛m c畉 hai kh坦a
c畛a hai ki畛u th畛c th畛 c嘆n l畉i. N畉u kh担ng c坦 ki畛u th畛c
th畛 b棚n ph鱈a m畛t th狸 kh坦a c畛a quan h畛 bao g畛m c畉 ba
kh坦a c畛a ba ki畛u th畛c th畛.
Thu畛c t鱈nh c畛a quan h畛 l thu畛c t鱈nh c畛a m畛i li棚n k畉t.
54. Chu畉n h坦a d畛 li畛u (1)
Chu畉n
h坦a d畛 li畛u
data normalization
Chu畉n h坦a d畛 li畛u l m畛t qu叩 tr狸nh thu畉n ngh畛ch t畛ng
b動畛c 畛 thay th畉 t畉p h畛p c叩c quan h畛 cho tr動畛c thnh
c叩c quan h畛 c坦 c畉u tr炭c 董n gi畉n h董n v chu畉n h董n.
Chu畉n h坦a d畛 li畛u nh畉m 畛 c畉i ti畉n m畛t thi畉t k畉 CSDL
th畛a m達n c叩c rng bu畛c ton v畉n v tr叩nh d畛 li畛u b畛 l畉p
l畉i kh担ng c畉n thi畉t.
55. Chu畉n h坦a d畛 li畛u (2)
M畛c 鱈ch
c畛a chu畉n h坦a d畛 li畛u
Lo畉i b畛 c叩c b畉t th動畛ng (anomaly) c畛a m畛t quan h畛 畛
c坦 動畛c c叩c quan h畛 c坦 c畉u tr炭c t畛t h董n, nh畛 h董n.
Quan h畛 c坦 c畉u tr炭c t畛t (well-structured relation)
C坦 s畛 d動 th畛a d畛 li畛u l t畛i thi畛u.
Cho ph辿p ng動畛i s畛 d畛ng th棚m vo, c畉p nh畉t v x坦a b畛 d畛
li畛u m kh担ng g但y ra s畛 m但u thu畉n d畛 li畛u
56. Ph畛 thu畛c hm
FD Functional Dependency
Cho r l m畛t quan h畛, X v Y l hai t畉p thu畛c t鱈nh
c畛a r.
Ch炭ng ta n坦i X x叩c 畛nh hm Y ho畉c Y ph畛 thu畛c
hm vo X, k箪 hi畛u l X
Y v 動畛c g畛i l ph畛
thu畛c hm n畉u v畛i m畛i gi叩 tr畛 c畛a X trong r ch畛
t動董ng 畛ng v畛i m畛t gi叩 tr畛 c畛a Y.
Kh坦a c畛a m畛t quan h畛 x叩c 畛nh hm c叩c thu畛c t鱈nh
kh担ng kh坦a c畛a quan h畛 ny
57. C叩c lo畉i ph畛 thu畛c hm
Ph畛 thu畛c hm ri棚ng ph畉n
partial functional dependency
X
A 動畛c g畛i l ph畛 thu畛c hm ri棚ng ph畉n n畉u t畛n
t畉i Y X 畛 cho Y A.
Ph畛 thu畛c hm 畉y 畛
full functional dependency
X
A 動畛c g畛i l ph畛 thu畛c hm 畉y 畛 n畉u kh担ng
t畛n t畉i Y X 畛 cho Y A.
Ph畛 thu畛c b畉c c畉u
transitive dependency
X
A 動畛c g畛i l ph畛 thu畛c b畉c c畉u n畉u t畛n t畉i Y 畛
cho X Y, Y A, Y / X v A XY.
58. Ph畛 thu畛c hm ri棚ng ph畉n
Ph畛 thu畛c hm ri棚ng ph畉n
partial functional dependency
X
A 動畛c g畛i l ph畛 thu畛c hm ri棚ng ph畉n n畉u t畛n
t畉i Y X 畛 cho Y A.
59. Ph畛 thu畛c hm 畉y 畛
Ph畛 thu畛c hm 畉y 畛
full functional dependency
X
A 動畛c g畛i l ph畛 thu畛c hm 畉y 畛 n畉u kh担ng
t畛n t畉i Y X 畛 cho Y A.
V鱈 d畛:
Ph畛 thu畛c hm {M達 SV, M担nh畛c} i畛m l ph畛 thu畛c
hm 畉y 畛 v狸:
M達 SV ko th畛 x叩c 畛nh i畛m
M担nh畛c ko th畛 x叩c 畛nh i畛m
M達 SV v M担nh畛c m畛i x叩c 畛nh 動畛c i畛m
60. Ph畛 thu畛c b畉c c畉u
Ph畛 thu畛c b畉c c畉u
transitive dependency
X
A 動畛c g畛i l ph畛 thu畛c b畉c c畉u n畉u t畛n t畉i Y 畛
cho X Y, Y A, Y / X v A XY.
V鱈 d畛:
SV(MaSV, H畛t棚n, M達l畛p, T棚nl畛p, Kh坦ah畛c)
FSV = { f1:MaSV H畛t棚n, M達l畛p, T棚nl畛p;
f2: T棚nl畛p Kh坦ah畛c}
T畛 MaSV suy ra 動畛c Kh坦ah畛c
Hay n坦i c叩ch kh叩c {KhoaHoc} ph畛 thu畛c b畉c c畉u vo
{MaSV}
#57: Ph畛thu畛chmFD Functional DependencyCho rlm畛tquanh畛, XvYlhait畉pthu畛ct鱈nhc畛ar. Ch炭ngtan坦i X x叩c畛nhhm Y ho畉c Y ph畛thu畛chmvo X, k箪hi畛ulXYv動畛cg畛ilph畛thu畛chmn畉uv畛im畛igi叩tr畛c畛aXtrongrch畛t動董ng畛ngv畛im畛tgi叩tr畛c畛aY.Kh坦ac畛am畛tquanh畛x叩c畛nhhmc叩cthu畛ct鱈nhkh担ngkh坦ac畛aquanh畛ny