Database Access Lectures
This module introduces two different ways to access a database, sending SQL statements and using an O/R mapping framework.
1. SQL Tutorials
This is not a database course, and there is no video on databases or SQL recorded for the course. Instead, there is some online material below for those who need to study SQL.
- https://www.w3schools.com/sql/ Links to an external site.
- https://www.tutorialspoint.com/sql/ Links to an external site.
2. SQL statements and Java Database Connectivity, JDBC
This part explains how to use JDBC to send SQL statements to a database.
Source Code
The programming examples can be found in GitHub, https://github.com/KTH-ID1212/db
Videos
- Introduction to JDBC
Links to an external site.
-
A client-server bank program, which uses JDBC to persist data in a database
Links to an external site.
The example above illustrates the following.
- JDBC usage
- Using an integration layer for database access in a layered architecture
- The Database Access Object (DAO) pattern
- The Data Transfer Object (DTO) pattern
- Race condition problems when multiple clients update server state
3. O/R mapping and Java Persistence API, JPA
This part explains how to use JPA to interact with an O/R mapper.
Source Code
The programming examples can be found in GitHub, https://github.com/KTH-ID1212/db
Videos
Introduction to JPA, and a client-server bank program, which uses JPA to persist data in a database
Links to an external site.The example above illustrates the following.
- Object-relational (O/R) mapping
- JPA usage
- Solving race conditions with a transaction API instead of the synchronized keyword.