Work alone or with proper pair programming practices.
Turn in assignment as both a hardcopy in class and a zipped file, using this link to cardea. Please have all your code as runnable .java files.
The purpose of this assignment is to give you some practice writing java code that issues queries to a DBMS (database management system) and processes the results.
For this assignment, we will be using mysql, an open-source database management system package. To get started, read the online tutorial.
For reference purposes, there is also detailed online documentation
Kevin has created a MySQL database for everyone in the class who didn't already have one. He based this on the class mailing list, so if there is anyone in the class who is not on the mailing list, they don't have a MySQL database. He created the databases using the UNIX/NT username for the name of the database as well as both the username and password for accessing the database. We use dream as our MySQL server. For example, Allison B. would use the following to connect to her database:
Each database has already been set up with a single table (called 'mytable') with two columns and two rows of data.
You can get familiar with interacting with SQL and mysql by calling it from the Unix command line and issuing queries, as shown in lecture. There is a nice feature -- if you type contol-P, it brings up the previous command that you typed and lets you edit it. Multiple control-p's move farther back in your query history.
As seen in class, it is very simple to access a database using java via the JDBC API. Use the code provided in class, called TestDB.java, to get started, and the jar file that I'm calling mysql.jar. For more details on how to set this up, see Lab 14.
Note that you should not simply use the supplied code as is, and type in database commands at the command line. The provided code is meant to show you how to make the connection, and how to use the ResultSet and ResultSetMetaData to do other things.
Instead, your program should have code that creates queries directly (rather than taking them from the command line). It should also take the results of queries and put them into data structures of some kind, and then do something with those data structures.