Lecture 11: Networking and Databases

What You Will Learn Today

  1. Connect to a web server using Telnet.
  2. Create a Java client and server using stream sockets.
  3. Compare connection-based and connectionless TCP/IP protocols.
  4. Use datagram sockets and packets.
  5. Create a URL connection.
  6. Process HTTP GET and POST requests from HTML forms.
  7. Identify and handle exceptions related to sockets and connections.
  8. Use basic SQL commands to create relational database tables and query them.
  9. Compare some available databases.
  10. Install a database server and JDBC driver.
  11. Write Java programs to connect to the database and execute SQL statements.

Connecting to a Web Server using Telnet

Creating a Java Client

Creating a Java Server

TCP/IP Protocol Suite

Datagrams

Creating a URL Connection

Processing HTML Forms

Network Exception Handling

SQL Basics

Relational Databases

SQL Queries

Some Available Databases

Type Examples Advantages Disadvantages
Commercial Oracle, DB2, Informix, Sybase, Microsoft SQL server powerful, fast complex, proprietary, expensive
Open-source PostgreSQL, MySQL, mSQL, Interbase powerful, fast, free difficult to install
Java Cloudscape, InstantDB, Pointbase small, easy to install and use not powerful, not fast
Desktop Paradox, Access popular, easy to install and use, GUI proprietary, not powerful, not cheap

Installing a Database

Installing the JDBC Driver

Connecting to the Database

Executing SQL Statements

Using Result Sets

To Do After Class