31. In what system property does the DriverManager object look for Driver objects?
A. jdbc.drivers
32. List the three different methods that the DriverManager can use to create a connection to the database.
A. getConnection(String), getConnection(String, Properties), getConnection(String, String, String)
33. For what type of applications should Sybase SQL Anywhere be used?
A. Smaller to mid-size applications having less than 100 users.
34. What is a logical unit of work?
A. A statement or a group of statements that performs one general function.
35. What is contained within a transaction log?
A. The list of statements executed against the database since the last commit or rollback.
36. What setting of AutoCommit will force a commit after every SQL statement?
A. TRUE(on)
37. Describe the difference between the commit and rollback?
A. commit will clear the log and make the settings permanent; rollback will clear the log and reset the database to its original state.
38. What does the CEILING function do?
A. Returns the smallest integer larger than the specified number.
39. What would be the FLOOR function return if passed 7.4?
A. 7
40. What does the SOUNDEX function do?
A. Returns an integer value that represents the string.
41. What does the TRIM function do?
A. Removes all leading and trailing spaces.
42. What does the DATALENGTH function return?
A. Returns the size of the column, in bytes for a table.
43. What does the NOW function return?
A. Returns the current data and time.
44. What is the difference between a connection and a statement?
A. A connection is a link to a database; a statement is used to send commands to a database.
45. Why would you use the execute() method of the Statement object?
A. If the SQL statement returned multiple results.
46. What is the difference between having AutoCommit on or off?
A. AutoCommit on will commit after every statement; off will force the user to issue commits.
47. Describe the effects of commit and rollback.
A. commit will clear the log and make changes permanent; rollback will clear the log and reset the database to its original state.
48. Is a Statement object used for static or dynamic SQL statements?
A. It is used for static statements.
49. What is the difference between ExecuteQuery() and ExecuteUpdate()?
A. ExecuteQuery() will execute a SQL Select statement. ExecuteUpdate()
will execute SQL Insert, Delete and Update statement.
50. How do you create a DatabaseMetaData object?
A. Use the getMetaData() method.
51. What are the different types of database tables?
A. User tables and system tables.
52. What is the syntax for getting a list of columns for a table?
A. getColumns()
53. What is the difference between getExportKeys() and getImportKeys()?
A. Exported keys are primary keys in a table that are used in other tables, Imported keys are columns used in a table that are a part of the mary key in another table.
54. What character do you use to indicate a dynamic parameter?
A. The ? character.
55. What three different types of parameters can be passed to a stored procedure?
A. IN, OUT and INOUT.
56. What method is used to create a PreparedStatement object?
A. preparedStatement(String)
57. What method is used to create a CallableStatement object?
A. prepareCall(String)
58. What does the registerOutParameter() method do?
A. It labels a parameter as being an OUT parameter so that it can be accessed after execution.
59. What does the wasNull() method tell you?
A. Determines whether the last item read was NULL.
60. What are some advantages to using stored procedures?
A. Allows for execution of multiple SQL statements, faster processing and simplified development.
61. What are some advantages to using dynamic SQL statements?
A. They execute the same SQL statement with different parameters.
62. What is an INOUT parameter?
A. A parameter that contains a value going into the procedure but can contain a different value when the procedure is finished.
63. What is the difference between an IN and OUT parameter?
A. IN procedures have values going into the procedure; OUT parameters have values coming out of the procedure.
64. In what two ways can you specify a column when you use the getxxx() method?
A. By name or by index.
65. How can you delete a record using the ResultSet object'c cursor?
A. Use getCursorName().
66. On what record is the cursor initially positioned in the ResultSet object?
A. The cursor is positioned on a NULL record before the first record.
67. What method moves you to the next record in the result set?
A. next()
68. Is there any way to move the cursor to the previous record? If so, what is it?
A. No.
69. What is the AutoIncrementing column?
A. A column that automatically inserts a new number into the column.
70. How is the column name different from the column label?
A. The column nameis the name as listed in the table schema; the label is what should be displayed to the user.
71. What is the precision of a column?
A. The number of digits each data value will contain.
72. What does the getColumnDisplaySize() method do?
A. Gets the number of characters that are needed to display the full column.
73. How do you determine whether a column can accept SQL NULL values?
A. isNULLable()
74. How many sections does a standard SQL Select statement contain?
A. Three.
75. In a Select statement, what does the From clause specify?
A. The tables that should be looked through.
76. What does the setRow() method do?
A. Sets the row for the object.
77. How would you determine which row the Select object is currently on?
A. The getRow() method.
78. What is the difference between specifying columns and not specifying columns in the first section of the Insert statement?
A. Not specifying columns means that you have to include all column data values in the correct order.
79. Why should you always specify columns in an Insert statement?
A. So that you will be insulated from database changes.
80. What would be the syntax to delete all records from tMyTable?
A. Delete from tMyTable
81. How would you delete all records from tMyTable using the Delete object?
A. Use the deleteAll(String) method.
82. What is specified in the Set section of the SQL Update statement?
A. The column that will be updated.
83. If getSuccess() returns false, was the execution of the SQL statement successful or not?
A. The execution was not successful.
84. What are the four data interfaces that you will be using to build the data components?
A. DataConnection, DataComponent, DataUpdate and DataNavigation.
85. What is the difference between the two different setConnection() methods?
A. One will reset the component, whereas the other gives the user the option to reset the component.
86. What value does the retrieve() method return?
A. The number of records retreived.
87. What are the four SQL types that are used in the DataUpdate interface?
A. DELETE, INSERT, UPDATE and SELECT
88. What is the purpose of the previewStatement() method?
A. It enables the user to add application-specific business logic.
89. What does the reset() method do?
A. Clears all settings for the component.
90. What method would you use to set the record position to the fifth record?
A. setRow()
91. What value does the getColumnType() method return?
A. An integer that contains a predefined constant identifying the data type.
92. List the two ways in which you can move the record position to the initial record.
A. first() and setRow(1).
93. List the two ways in which you can move the record position to the last record.
A. last() and setRow(getRow())
94. What constructor gives you the most initial options to specify?
A. DataField(length, Connection, sql, boolean)
95. What is the difference between the two setConnection() methods?
A. One enables the user to reset the component, whereas the other forces a reset of the component.
96. What does the retrieve() method do?
A. It retrieves data from database.
97. Describe what the setRow() method does?
A. It moves the current record to a specified valid record.
98. What does the getColumnType() method return?
A. It returns the type of the column specified.
99. What two values are passed to the previewStatement() method?
A. The SQL statement to be executed and the typeof statement.
100. What does returning a false from the previewStatement() do?
A. Cancels the execution of a particular SQL statement.
101. Name two ways to set the record to the initial record immediately.
A. first() and setRow(1)
102. What does setItem() enable you to do?
A. Set the data value for a particular item.
103. How do you specify an update table to be tEmployeeAddress?
A. setUpdateTable("tEmployeeAddress")
104. List all of the constructor methods for the DataList component.
A. DataList(), DataList(int), DataList(int, Connection, string), DataList(int, Connection, String, boolean)
105. How do you have the component retreive data without calling the retrieve() method?
A. Use the DataList(int, Connection, String, boolean)method and pass it a true value.
106. What method enables you to change the Connection object?
A. setConnection()
107. How would you change the Connection object without resetting the component?
A. setConnection(Connection, false)
108. How would you get the number of records in the component?
A. rowCount()
109. What two items must be specified for an update to occur?
A. Update the table name and at least one update column.
110. What does the previewStatement() method return and what does it mean?
A. It returns a Boolean value indicating whether the SQL statement should be executed.
111. Initially, are the records in the component and the items in the list same?
A. Yes.
112. How can you add new items to the list for display?
A. addItem()
113. How can you display the last column in the component(there are two ways)?
A. last(), setRow(getRow())
114. What are the two variables that indicate on and off for the onent?
A. onCheck and offCheck
115. What does the DataCheckBox(String label) constructor method do?
A. Create the check box object with a label.
116. What does the setConnection(Connection, boolean) method do?
A. Changes the Connection object and resets or doesn't reset the onent depending on the Boolean value.
117.How can you change the Connection object without resetting the other variables in the component?
A. setConnection(Connection, false)
118. How can you specify the SQL statement for the component?
A. setSQL()
119. What is the difference between the User and Original Hashtable objects?
A. The original object stores the data values retrieved from the database the User object stores values entered by the user.
120. What method would you call to reset the component?
A. reset()
121. What will happen if you call the next() method and no next record exists?
A. The component will remain on the current record.
122. What will happen if you call update() method and have not specified an update table?
A. The update will not occur.
123. What does the getColumnType() method return?
A. This method returns the column type as a predefined integer value.
124. Why doesn't the DataNavigator implement someof the data interfaces?
A. Not all of the functionality is required for the component.
125. How does the DataNavigator store the connected components?
A. In a hash table of objects.
126. Name the four buttons on the DataNavigator component.
A. First, Previous, Next and Last.
127. How would you hide the Last button?
A. showLast(false);
128. How would you show the Last button?
A. showLast(true);
129. How would add a component to the DataNavigator?
A. addComponent()
130. What method does the DataNavigator implement from the DataUpdate interface?
A. update()
131. What does the retrieve() method return?
A. The maximum number of records retrieved from any component.
132. What is stored in the max variable?
A. The maximum number of records retrieved from any component.
133. Name some differences between the DataNavigator component and the other data components.
A. This component does not directly store any data values.
134. How is the DataPanel component different from the other components?
A. It displays more than one column's data values.
135. What method enables you to get the number of records that are in the result set?
A. recordCount()
136. What is displayed in the description labels on the panel?
A. The column name.
137. What does the retrieve() method do differently than the other ponents?
A. Adds the Label components to the panel.
138. What layout does the component use to display the Label objects?
A. GridLayout.
139. Why are you using the same Connection object for all windows?
A. So that you don't have to create multiple connections to the database.
140. What does the dbConnect() method do?
A. It connects the application to the database.
141. Why do you clear all articles before adding new items in the getArticle() method?
A. So that duplicate articles do not appear in the list.
142. Why is it important to always close the Statement object after you use it?
A. So that the resources used by the object are released back to the system.
143. What event handles all of the user's actions on the window?
A. handleEvent()
144. Why do you change the cursor before displaying a new window?
A. So that the user has some indication that the process is working.
145. What is the purpose of the displaySearchArticles() method?
A. To display articles that match a specified keyword.
146. Why do you use a splash screen?
A. To give the user something to be occupied with while the application loads.
147. What method gets the current Toolkit object for the component?
A. getToolkit()
148. What method draws an image on the component?
A. drawImage()
149. What information does the About dialog box display?
A. Application and company information.
150. Where is the About dialog box called from?
A. From the Help menu.
151. What does the Resources Choice object display?
A. The application and/or technologies that an article is associated with.
152. What is entered into the article keyword edit field?
A. Keywords that will be identified with the article.
153. What two items are checked to ensure that the user has entered values in the Add dialog box?
A. Article title and article text.
154. What Java object is used to parse the keywords entered by the user?
A. StringTokenizer
155. What does the hasMoreTokens() method tell you?
A. Whether there are more keywords left to process.
156. What must the Layout Manager be set to in order to alter component sizes manually?
A. NULL
157. What is the method used to change the size and placement of a ponent manually?
A. reshape()
158. What is a modal window?
A. A window that is active until it is closed.
159. If a dialog box is modal, can the user switch between the application window and the dialog box window?
A. No.
160. What three arguments are passed to the constructor for the Dialog class?
A. Parent frame, a title, and a Boolean value indicating modal state.
161. Why is it always a good idea to close a Statement object manually?
A. To free resources that are used by an object.
162. What is an orphaned record?
A. A record that is left in the database but has no parent information.
163. Why should you always delete child records before deleting the main record?
A. To prevent orphaned records.
164. What table contains the keywords that the user entered for the article?
A. tKeyword.
165. What is the method called by the Search Articles dialog box to play the articles in themain window?
A. displaySearchArticles()
166. What interface in Java1.1 enables you to "listen" for normal mouse events?
A. MouseListener
167. What method adds an ActionListener interface to listen to events for a specified component?
A. addActionListener()
168. What method returns the name of the menu item selected?
A. getActionCommand()
169. What method displays a pop-up menu to the user?
A. show()
170. What is passed to the show() method of the PopupMenu object?
A. A container object and the position to display at.
171. Name the two objects used to allow serialization in Java.
A. ObjectOutputStream and ObjectInputStream
172. What method enables you to write an integer to a stream using ObjectOutputStream?
A. writeInt()
173. What method enables you to read an object from a stream using ObjectInputStream?
A. readObject()
174. What parameter does the MenuShortcut constructor take?
A. An integer value identifying an ASCII character.
175. What does RMI stand for?
A. Remote Method Invocation.
176. How many thread objects will the object server use for client connections?
A. Seven.
177. What is the URL for the database we are using?
A. jdbc:odbc:JDBC
178. What method of the IDList component returns the employee ID for the selected item?
A. getSelectedID()
179. What object is used to listen for client connectioins?
A. ServerSocket
180. What method connects a client to a server?
A. accept()
181.What method is used to get the output stream for a socket object?
A. getOutputStream()
182. What method is used to read String objects from an object stream?
A. readObject()
183. What method clears the contents of an object output stream to ensure that the client receives the data?
A. flush()
184. What is the purpose of the Delete object?
A. To delete specified employees from the database.
185. What object is used to send the deleteEmployeeDialog to the client?
A. ObjectOutputStream
1. What's the JDBC 2.0 API?
The JDBC 2.0 API is the latest update of the JDBC API. It contains many new feat ures, including scrollable result sets and the new SQL:1999 (formerly SQL 3) dat a types. There are two parts to the JDBC 2.0 API:
the JDBC 2.0 core API (the java.sql package), which is included in the JavaTM 2 SDK, Standard Edition
the JDBC 2.0 Optional Package API (the javax.sql package), which is available se parately or as part of the Java 2 SDK, Enterprise Edition
2. Does the JDBC-ODBC Bridge support the new features in the JDBC 2.0 API?
No, the JDBC-ODBC Bridge that is included in the Java 2 Platform initial release does not support the new features in the JDBC 2.0 API. However, Sun and Merant are working to produce a new version of the Bridge that does support the new fea tures. Note that we do not recommend using the Bridge except for experimental pu rposes or when you have no other driver available.
3. Can the JDBC-ODBC Bridge be used with applets?
Use of the JDBC-ODBC bridge from an untrusted applet running in a browser, such as Netscape Navigator, isn't allowed. The JDBC-ODBC bridge doesn't allow untrust ed code to call it for security reasons. This is good because it means that an u ntrusted applet that is downloaded by the browser can't circumvent Java security by calling ODBC. Remember that ODBC is native code, so once ODBC is called, the Java programming language can't guarantee that a security violation won't occur . On the other hand, Pure Java JDBC drivers work well with applets. They are ful ly downloadable and do not require any client-side configuration.
Finally, we would like to note that it is possible to use the JDBC-ODBC bridge w ith applets that will be run in appletviewer since appletviewer assumes that app lets are trusted. It is also possible to use the JDBC-ODBC bridge with applets t hat are run in the HotJavaTM browser (available from Java Software), since HotJa va provides an option to turn off applet security. In general, it is dangerous t o turn applet security off, but it may be appropriate in certain controlled situ ations, such as for applets that will only be used in a secure intranet environm ent. Remember to exercise caution if you choose this option, and use an all-Java JDBC driver whenever possible to avoid security problems.
4. How do I start debugging problems related to the JDBC API?
A good way to find out what JDBC calls are doing is to enable JDBC tracing. The JDBC trace contains a detailed listing of the activity occurring in the system t hat is related to JDBC operations.
If you use the DriverManager facility to establish your database connection, you use the DriverManager.setLogWriter method to enable tracing of JDBC operations.
If you use a DataSource object to get a connection, you use the DataSource.setL ogWriter method to enable tracing. (For pooled connections, you use the Connecti onPoolDataSource.setLogWriter method, and for connections that can participate i n distributed transactions, you use the XADataSource.setLogWriter method.) 5. How can I use the JDBC API to access a desktop database like Microsoft Access
If you use a DataSource object to get a connection, you use the DataSource.setL ogWriter method to enable tracing. (For pooled connections, you use the Connecti onPoolDataSource.setLogWriter method, and for connections that can participate i n distributed transactions, you use the XADataSource.setLogWriter method.) 5. How can I use the JDBC API to access a desktop database like Microsoft Access