Java Reference
In-Depth Information
public String getPostText(int index) {
return (String) postText.elementAt(index);
public String getQuery() {
return query;
public int getSize() {
return author.size();
public String getSubject(int index) {
return (String) subject.elementAt(index);
public void setParent(String newParent) {
parent = newParent;
These are the attributes for our command, along with the get and set meth-
ods. Since we'll have a different value for every row, we'll allocate a vector to
store the results.
public void initialize()
throws IOException, {
try {
Class.forName ("").newInstance();
String url = "jdbc:db2:board";
// connect with default id/password
connection = DriverManager.getConnection (url);
} catch (Throwable theException) {
As with the other commands, we initialize our database connection. In chap-
ter 7, we'll pool these connections for performance.
public void execute ()
DataException {
query =
"select subject, author, board, postData, number "
+ "from posts where (number = "
+ getParent()
Search WWH ::

Custom Search