This lab introduces you to database access from a programming language such as
Java or C#. A sample set of exercises can be found here; although phrased using
Java/JDBC, the exercise can be done using other languages, OBDC or ADO.NET APIs
In this assignment, you will write a java program which takes any of the following commands as command line argument (not as input), and executes them using JDBC:
insert into relationname value1 value2 value3 ..
select from relationname
select from relationname where "condition"
select from relationname1 relationname
Note: In netbeans, to pass parameters to a program, you can right click on the project, choose configuration > customize. Or run this as a standalone java program instead of using netbeans (after you develop it using netbeans). Use the parameter argv to the main function, which provides you an array of Strings, with each word above part of one string. Use argv.length to figure out how many parameters are present.
For 0 extra credit: If you finish the above early and are bored, try adding column names to the select from relationname option; assume from is not a valid column name. You get no extra marks, except that if you goof up an earlier part, you may still get full marks on the assignment if you do this right (it's very unlikely you will do this part if you goof up an earlier part, anyway)