Object-Oriented Programming, 11th Seminar

dat1/inf1, Autumn 2002

Location

B3-104

Time

November 8, 10.15-12.00

Subject

Most Java programs needs to store data persistently, i.e., object must live between program invocations. This is typically done in a database system. In this seminar two topics will be covered.

First it will give a short introduction to the standard database query language SQL. It will be shown how to

  • how to create tables in a database,

  • how insert, update and delete data in tables

  • how to query data stored in tables

Second, it will show how to connect the Java programming language to the SQL query language, such that it is possible to modify and query data stored in a database via SQL in a Java program. For this purpose a the standard Java library JDBC will be used.

Java also supports lightweight persistence in the form of object serialization where objects are written to disk as a stream of bytes. This method does not scale well and for this reason we focus on SQL/JDBC (which scales very well) in the course instead of object serialization. Serialization was covered lightly in the seminar on the Java I/O system.

A lot of stuff is going on in the area of persistence and Java (e.g., JavaSpaces) because it is a very important topic. Further, certain types of Enterprise JavaBeans can be stored "automatically" in databases.

Readings

JDBC Basics

Exercise

exercise 11

Slides

handouts

Links


Best regards,
Kristian Torp