Enterprise Systems Programming
Lab 3: JDBC
Create a Java class called LabDB that connects to the
Owners database that we used last week.
Make sure you register the database under a DSN called owners .
You have to support two queries
that correspond to the following methods:
- public static String getOwners( String desc ):
given a THING description, return names of owners
who own things that match the description.
For example, if desc is "Cape",
the method should return:
Clark Kent, Bruce Wayne
because these two owners own such things.
If there are no owners,
return NO OWNERS .
- public static double getTotalCost( String init ):
given the initials of an OWNER,
returns the total cost of things the owner owns.
For example, if init is "CK",
total cost is 199.0 ,
because Clark Kent owns a Cape (100) and Eye Glasses (99).
If there is no such person with those initials
or there are no things owned,
return 0 .
You may test your class using this
tester program
(You may not edit this program).
The following
output should result.
When you are done, zip the two Java programs
(LabDB.java and Lab3Tester.hava) into an archive called
[idnumber]-Lab3.zip or [idnumber]-Lab3.rar.
Submit this archive through
moodle .
You may work in pairs, but each pair must make a submission.
If working in pairs, make sure you place both names
in the LabDB.java file.