k so I have created a database called dictionaryDatabase using Apache Derby in Java. The database has a table called dictionaryTable and contains two columns, wrongWord and rightWord. Here's what I have so far:
String keyWord = "test";
getWords = conn.prepareStatement(
"SELECT wrongWord FROM dictionaryTable WHERE wrongWord = (?)");
Now, for every wrongWord that does match keyWord, I wish to retrieve the value from the rightWord column in the same row in which the wrongWord value matched keyWord.
I have tried the following, but that doesn't work:
ResultSet existingKeywords = getWords.executeQuery();
while (existingKeywords.next()) {
//Get rightWord column values here
}
What should I be doing here, and am I on the right track?
Thanks!