Most Common Mistakes

 

[-15 pt] A number of people missed the query for 1a. You were finding people who teach a course outside their own department, rather than people who teach no course in their department

 

[-10 pt] A number of you decided to load the driver and open a connection anew for each query. This is very expensive; in fact, if you try to run as little as 10 queries in a row, you’d notice performance degradation

 

[-10 pt] Some people update the tables on per-record basis. I.e. they have a loop which traverses the recordset, and within that loop they call executeUpdate(). This is very expensive and certainly not what you were meant to do for the updates. The point is, this is not an acceptable strategy, if you had a really big result set, as it would lead to a very big number of Jdbc calls

 

[-5 pt] Part 3b.

This is a really minor point, but I haven’t taken many points off either. A number of you used next()&&next() or a combination thereof. If you nested the two and the second next() is not part of a conditional statement, it would simply generate an exception when your result set returns an odd number of tuples.

Even if you do the check, the point of this exercise was to make you realize there are ways to traverse the recordset by more than 1 tuple at a time. If you were asked to display every 7th, nesting of next() would hardly be the way.

 

 

Extra Credit:

 

[+10 pt] A GUI of your own

[+ 5 pt] Rachel’s text area output

 

 

Solutions:

If you’re trying to run the java code, modify the DSN to the one that is created on your machine

            Here is a basic code hw2.java

            Thanks to your classmates, you can also view sample code for the extra credit part:

            cse444.java  or ASP