Homework 01 Solution




The goal of this first homework is to have you establish the Derby and SimpleDB database management systems within a Eclipse Java development environment. With these two DBMSs you’ll be able to see some basic SQL in action, and start your understanding of relational data modeling and SQL. Answer the specific questions in the following document. Turn in your answers via a pdf file uploaded to eCampus, and turn in a hard copy of your answers at class time on the due date. Your turnin should include your signature below the Aggie honor code statement: An Aggie does not lie, cheat or steal or tolerate those who do.

1. Set up your development machine to run Eclipse, which is a free Java IDE that you can download free from www.eclipse.org. I’m using the Mars” and Oxygen” versions. [Note: For consistency, I want the whole class to use Eclipse, so use it please.] Create a Java project, add a Java Hello Database World’ main class to it

with a System.out.println statement, and run it as a Java application’. You should see

Hello Database World’ appear in the console window. If this fails, check your println statement and make sure your machine has a recent installation of the JDK 8, or higher, from http://www.oracle.com/technetwork/java/javase/overview/index.html. Check to make sure the installed Java runtime is tied into Eclipse—Under Eclipse, click Window->Preferences->Java>Installed JRE and you should see it installed. If not, click the Add button and add it. Turn in a printed screen shot of the Eclipse window showing the HDW app source and output from execution

2. Follow the instructions given below to download and install SimpleDB as an Eclipse project. This problem can take 30 minutes, or 3 days depending on how adept you are at fiddling with and getting code to run that you did not create!

1. Unpack the SimpleDB_2.10 distribution from http://www.cs.bc.edu/~sciore/simpledb/

2. Create an ECLIPSE Project and name it SimpleDB

3. Copy/paste the folders simpledb and studentClient into the ECLIPSE


4. For the time being, delete all the project folders marked with a redX

5. Start the simpledb server: right mouse click the Startup code, select Run As Java Application and modify its Run Configuration. Select the Arguments” tab and enter the database name—studentdb, hit the Apply button and then Run it.

6. A console window will open and you’ll see the output of the server, database server ready

a) Turn in printed screen shots of the Eclipse window showing the SimpleDB Startup server source code and the output of the server console window. What does the red rectangle mean in the server console window?

b) Turn in a printed screen shot of the Eclipse window showing the CreateStudentDB code and the output in the console window of running that code. Looking only at the CreateStudentDB source code, write a comment statement describing what the program does.

c) The server Startup console should have more output on it as a result of executing CreateStudentDB. Turn in a screen shot of the modified output console. Notice the red rectangle is still present in the server console window. Why?

d) In your file system, locate thestudentdb’ folder that was created and turn in a copy of the directory of the entries in the folder. By looking at the application, can you determine the names of the tables created and what names SimpleDB uses for its tables? Which program actually created the folder studentdb—Startup or CreateStudentDB?

Note: http://www.cs.bc.edu/~sciore/simpledb/

3. Install DERBY: Follow the instructions at the link to install Derby on your system, http://db.apache.org/derby/papers/DerbyTut/index.html. Work thru the instructions and verify that the Java SDK is installed by running in a command window

4. Follow the instructions to run the Derby SQL command interpreter named ij to create a manfDB database and populate it by making and running SQL scripts for the following SQL. Turn in the ij console input and output. Make sure you can explain each statement.