JDBC Assignment                                         P.Komisar
 



  Following is a quiz on the first half of the excellent JDBC tutorial by Maydene Fisher
  located at the sun site at  at http://java.sun.com/docs/books/tutorial/jdbc/basics/index.html

1.  What line of code would you need to load the driver which translates Java Database
     Connectivity commands into Microsoft's Open Database Connectivity specification?

2.  Write a line of code returning a Connection object named, bugCon, given the url,
     jdbc:cyberbase:bugs, a password, sos, and a login name bugreporter543.

3.  Given a connection object called, dCon, what line of code would return a Statement
     object named, dState?

4.  What single or pair of statements would create a 4 columns table, the first column called
     RECORD ( sql type INT ) , the second column called DESCRIPTION
     ( sql type VARCHAR, maximum 16 characters ), the third column labelled QUANTITY
     ( sql type INT ) and the forth column called PRICE (sql type FLOAT), given a statement
     object dState?

5.  In the table created in Q.4, write jdbc code to insert 4 fictitious records.( one fictitious record
     example might have the values that appear in a table as follows: 100 ball  28  4.99 )

6.  What SQL statement would return the prices of the four record items?

7.  Return the the result of SQL statement in Q.6  as a ResultSet object using dState as the
     statement object and dResult as the name of the ResultSet object.

8.  getXXX( ) methods can access columns by _________ or_________ (Put the more efficient first).

9.  T/F getInt( ) can be used to retrieve sql INTEGER and BINARY types.

10. In the getXXX( ) methods table at the end of the JDBC Basics tutorial,
      a) what do the small x's refer to?   b) the large X's?

11. Write a String called newSale containing the SQL statements needed to update the tutorial's
      COFFEES table in order to set SALES for Expresso to 150. Given a Statement object called sT,
      write JDBC code to update COFFEES with the new information in newSale.