CSCI 403 Database Management

Spring 2018

Extra Credit Project: Program

(Back to Projects)

Purpose




Overview


The goal of this project is to create a complete working client/server database application (albeit a very simple and small one). You will be working with a subset of the music database that you worked with in Project 6; your program will provide functions to search, insert, modify, and delete album records from the database, and insert new artists. You are provided with a script (schema.sql) you can use to create and populate tables in your own schema. The script should pretty clearly define the database tables and constraints for you.

Before You Begin


Download the starter code: code.zip. This contains working (but only partially) GUI programs in Python and Java for you to complete. There are also text-based example programs, showing more query types.

The first thing you need to do is run the script schema.sql which is in code.zip against the database. The script will set up the simple tables needed for this project (note the names may conflict with the names of the tables you created for project 6 - in which case your project 6 tables may get dropped - sorry about that!) Once you've run the script, decide whether you want to work in Python or Java for this project. (Note: at this time I do not have MaxOS X instructions below - apologies, but I don't have access to a Mac at home. The linux instructions should mostly apply, though.)

Python

If you plan on working in Python for this project, then first make sure you have a working installation of Python 3 (if you prefer Python 2.7, you may have some significant porting to do - the tkinter GUI code is probably not backwards-compatible). You can obtain Python for your platform from https://www.python.org/downloads/.

Next, install the pg8000 connector via pip. The pip program comes with your python install; if you are on linux, you may need to run pip3 for the Python 3 version. On my Windows machine, pip.exe is installed under my user directory (C:\Users\Christopher\AppData\Local\Programs\Python\Python35-32\Scripts\pip.exe). If you are on Windows, you can find the directory where the python install lives by launching IDLE and choosing "Path Browser" from the File menu. Once you've figured out how to run pip from the command line, just do

        pip install pg8000
    

Once you've done all that, try running the starter code Python program named gui.py. On linux, you should be able to run gui.py from the command line (assuming python3 is installed in /usr/bin), or you can do

        python3 gui.py
    

from the command line in the directory where gui.py is. Or you can launch it from IDLE. On Windows, I find the easiest way is to run the program from IDLE, since python is typically not in your path. Launch IDLE, then use the File menu to open gui.py, then choose Run Module from the Run menu.

Java

If, instead, you intend to work in Java, make sure you have a working installation of the Java JDK (preferably version 8 or later). The Java JDK can be obtained at http://www.oracle.com/technetwork/java/javase/downloads/index.html. On linux, Java JDK (in the OpenJDK flavor) can usually be obtained from your package manager.

You will also need the postgresql JDBC jarfile, which you can obtain from here for Java 8. For Java 7, you will need a different jarfile, found here.

The java subdirectory in code.zip contains source code for four classes which together comprise the application. You can import these into your favorite IDE, or compile them from the command line using

    javac GuiApplication.java
    

For command line, copy the JDBC jarfile into the directory with the compiled code and then you can run the application with

    java -cp .:postgresql-42.1.4.jar GuiApplication
    

in the directory containing the .class files and the jarfile (substituting for the appropriate jarfile name as needed).

Running the code within your IDE requires you to set up the JDBC jarfile as an external library for your project, or possibly just setting up the classpath for executing the program. There are too many IDEs for me to provide instructions for each one - but it shouldn't be too difficult to figure it out, especially with help from Google.


Details


Let the GUI be your guide as to the functions you need to implement, but essentially there are the following:

The existing code provides GUI interfaces to handle each of the above functions; you just need to provide the database code. All of the methods you need to implement are marked with a TODO comment. They are all gathered in one place in the code - for the Java programmers, you need to look in GuiModel.java. All of the methods currently have some kind of stub code that provides some non-useful behavior (like printing a message to the command line). The search by artist method has been provided to give you some idea how to proceed with the remaining methods. Note there is an additional method you must provide to retrieve a list of artists from the database; this is used on the Insert album view.


Notes



Grading


README 1 points
Search function 2 points
Retrieve artists function 2 points
Insert artist function 3 points
Insert album function 4 points
Edit album function 4 points
Delete album function 4 points
Total: 20 points

Documentation:


README:

  1. Include names of all people who helped/collaborated as per the syllabus
  2. Describe the challenges you encountered and how you surmounted them
  3. What did you like/dislike about the assignment?
  4. How long did you spend on this assignment?

Submit a zip file on Canvas containing: