![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]()
![]()
(chat, newsreader, calendar)
|
![]() |
|
Course Notes Table of Contents | Exercises JDBC Short Course Index | Online Training Index
|
Help: Applet-Based Guestbook |
Working Applet | Help Solution
|
Help is available for each task, or you can go straight to the
source code, which is one particular
solution.
Use something like s.equals ("insert") as the if condition to check
for the insert command.
Use ObjectInputStream.readObject() to read the strings from the socket's InputStream. Ask the CommentsServer for the URL, username, and the password to use when getting your connection from the DriverManager. Use Connection.prepareStatement to create a statement. Use PreparedStatement.setString to place each parameter. Remember that arguments to prepared statements, start at 1, not 0. Use executeUpdate because the SQL statement to execute will update the database. Task 4For query mode:
Ask the CommentsServer for the URL, username, and the password to use when getting your connection from the DriverManager. Use Connection.createStatement to create statement. Remember to use findColumn to determine which column is for which field when examining the ResultSet. Task 5Close each statement.
Both the PreparedStatement and the Statement need to be closed
in their respective locations.
|
Copyright © 1997 MageLang Institute. All Rights Reserved May-97 Copyright © 1996, 1997 Sun Microsystems Inc. All Rights Reserved |