Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#22 Using Empty Result Set occur when using Database Dictionary

open
nobody
None
5
2005-09-05
2005-09-05
Anonymous
No

Initialize JWNL usign DatabaseBackedDictionary then
when any method that access the dictionary is called,
JWNL would throws a SQLException with message "Using
Empty ResultSet".

here is the exception stack trace:

0 [main] INFO net.didion.jwnl.dictionary.Dictionary -
Installing dictionary
net.didion.jwnl.dictionary.DatabaseBackedDictionary@e3b895
2
1
net.didion.jwnl.JWNLException: Error while accessing
database
at
net.didion.jwnl.dictionary.DatabaseBackedDictionary.getSynsetAt(DatabaseBackedDictionary.java:132)
at
net.didion.jwnl.data.IndexWord.loadSynset(IndexWord.java:107)
at
net.didion.jwnl.data.IndexWord.getSense(IndexWord.java:101)
at meme.garden.wordnet.WordNetLookup.main(Unknown
Source) Caused by: java.sql.SQLException: Illegal
operation on empty result set.
at
com.mysql.jdbc.ResultSet.checkRowPos(ResultSet.java:5327)
at
com.mysql.jdbc.ResultSet.getNativeString(ResultSet.java:5019)
at
com.mysql.jdbc.ResultSet.getNativeBoolean(ResultSet.java:4124)
at
com.mysql.jdbc.ResultSet.getBoolean(ResultSet.java:693)
at
net.didion.jwnl.princeton.data.AbstractPrincetonDatabaseDictionaryElementFactory.createSynset(AbstractPrincetonDatabaseDictionaryElementFactory.java:42)
at
net.didion.jwnl.dictionary.DatabaseBackedDictionary.getSynsetAt(DatabaseBackedDictionary.java:126)
... 3 more

when looked through the source and the error is caused
here:

public Synset createSynset(POS pos, long offset,
ResultSet synset,
ResultSet words, ResultSet pointers, ResultSet
verbFrames) throws SQLException {
synset.next();
boolean isAdjectiveCluster = synset.getBoolean(1);
String gloss = synset.getString(2);
// ...

where, as you can see, there is no check that the
ResultSet is not empty: if (synset.next())

Discussion