CS1116/CS5018 Lab 3

Before you start on this week's work, you have the opportunity to check the first part of last week's work (where you revised lengths.py to include validation of user input). This is an experimental facility, which gives rough-and-ready feedback. It is not used for grading.

Fix problems in your private study time. For now, move on to this week's work.

Step 1: Create a database

In your public_html/cgi-bin directory, create a new directory called lab3 (no spaces, all in lowercase!!!!!!). Change its permissions! Place your work for this lab sheet into this new directory.

Take a copy of the following file (right-click on each link and choose 'Save link as…') and save it in your public_html/cgi-bin/lab3 directory:

Do not modify eurovision.sql in any way.

As you did in CS1106/CS5021, use DBeaver to login to the MySQL DBMS on cs1.ucc.ie.

When you are connected to the DBMS, still using DBeaver, right-click in the SQL editor and choose 'Load SQL Script' from the menu. Use the file chooser to open the eurovision.sql file that you copied above.

If all of that worked OK, then you now have a new database table called winners, which has the following columns: year, country, song, performer & points.

If you want to check, then type:

select * from winners;

You should see a table of Eurovision winning songs.

You can now close down DBeaver.

Step 2: Write a program

In a file called eurovision.py in your lab3 directory, write a Python server-side program, as follows.

The program implements a self-processing page:

In case the previous paragraph is not clear, you can run mine to see what yours should do:

Step 3: Improve your program

When your self-processing page is working, improve your program. You may do as few or as many of these as you wish:


There is no formal submission of this week's exercises. However, for my records, I will run a program that checks to see whether you have done the work or not.