3. Database
• What is database?
– A database is an organized collection of data. The
data is typically organized to model relevant
aspects of reality (for example, the availability of
rooms in hotels), in a way that supports processes
requiring this information (for example, finding a
hotel with vacancies).
4. Database
• Database system consists of
– User
– Data
– Hardware
• Where data resides
– Software
• Database management system(DBMS)
• Controls storage and retrieval
5. Database
• The advantage of database
– Reduce redundancy
– Avoid inconsistency
– Share data
– Enforce standards
– Security restrictions
– Data integrity
– Balance conflicting requirement
7. Database
• Data independence
– Applications not dependent on how data stored or
accessed
– Applications can have different views of data
– Change storage/retrieval strategy without
changing applications
• Data dependency
– Change in storage or retrieval technique forces
program change
8. Database
• Database language
– Host languages
• Used to access database
• Can use high-level languages
– Java, C, C++, Visual Basic, COBOL, PL/I, Pascal
– Database sublanguage(DSL)
• Specifics of database objects and operations
• Combination of
– Data definition language(DDL)
– Data manipulation language(DML)
10. Distributed database
• A distributed database is a database in
which storage devices are not all attached to a
common processing unit such as the CPU,
controlled by a distributed database
management system. It may be stored in
multiple computers, located in the same
physical location; or may be dispersed over
a network of interconnected computers.
11. Distributed database
• Pros
– Local autonomy or site autonomy
• a department can control the data about them (as they are the
ones familiar with it)
– Protection of valuable data
• if there were ever a catastrophic event such as a fire, all of the
data would not be in one place, but distributed in multiple
locations
– Modularity
• systems can be modified, added and removed from the distributed
database without affecting other modules
– Continuous operation
• even if some nodes go offline (depending on design, like backup)
13. Relational Database
• A relational database is a database that has a
collection of tables of data items, all of which
is formally described and organized according
to the relational model.
14. Relational Database
• Composed of tables
– Rows called records(tuples)
– Columns are fields(attributes)
• First field usually primary key
– Unique for each record
– Primary key can be more than one field
– Cannot allow null values
18. Relational Database
• Advantages of relational database
– Tables easy to use, understand, and implement
– Projection and join operations easy to implement
– Easy to modify
– Great clarity and visibility
19. JDBC
• JDBC is an API for the Java programming
language that defines how a client may access
a database. It provides methods for querying
and updating data in a database. JDBC is
oriented towards relational databases. A
JDBC-to-ODBC bridge enables connections to
any ODBC-accessible data source in
the JVM host environment.
27. JDBC Implementation
– Has classes and Interfaces for using relational
databases
– Implements interface Connection
– Manages connection between database and
program
4 import java.sql.*;
11 private Connection connection;
34. Future Wrok
• Servelets
– A servlet is a Java programming
language class used to extend the capabilities of
a server. Although servlets can respond to any
types of requests, they are commonly used to
extend the applications hosted by web servers, so
they can be thought of as Java Applets that run
on servers instead of in web browsers.