Java & J2EE Page 2 - The JSP Files (part 5): No Forwarding Address |
If you're familiar with SQL, you know that there are four basic types of operations possible with a database: SELECT a record; INSERT a record; UPDATE a record; DELETE a record. In order to demonstrate these operations, we're going to build a little application that requires each of the functions listed above - an address book which allows multiple users to store and view contact information online. As always, one of the first things you have to think about when designing a data-driven application is the design of the database (duh!). For this application, we've decided to use a single table called "abook", which contains fields for different types of contact information - address, phone, fax, email address, and the like. Every user in the system has a unique login id, and each record in the database is "owned" by a specific user. We've put together a "dump file", which lets you create the database tables and initial set of records quickly - we suggest that you import this data into your mySQL database server, as we'll be using it throughout this article. To import the data, download the dump file and use this command at your mySQL prompt: Or you could insert the contents manually - here is what you 'll need: This will create a table named "abook" with columns for different types of contact information; these records are owned by three mythical users, "bill", "john" and "joe". Now check whether or not the data has been successfully imported with a SELECT query (the SELECT SQL statement is used to retrieve information from a database). Enter this at your mySQL command prompt: which, in English, means "display the columns uid, fname and lname from the address book". Here's what you should see:
blog comments powered by Disqus |