1

I have recently started using the Jackcess library in Java for dealing with MS Access databases. The library is pretty good but I have a question regarding searching rows.

Consider that I have "Jack loves apples" in a row of a column named X, what piece of code would I use to search for all the rows of X containing the word "apples"? I know this can be easily done using wildcards in SQL but since there is no way to use SQL queries in Jackcess, that's not a valid option.

I considered using UCanAccess but I have issues with the library, even if I use the "memory=false" option while loading the database, it still takes almost 1.4GB of memory.

2 Answers2

0

With Jackcess you need to iterate the rows and apply the filter yourself. As long as your filter is fairly static, this should be fairly easy to build.

centic
  • 15,565
  • 9
  • 68
  • 125
0

@centic's answer was accurate until jackcess version 3.5.0. As of the 3.5.0 release, you can use the new PatternColumnPredicate class to do various wildcard/pattern/regex searches using Cursors.

jtahlborn
  • 52,909
  • 5
  • 76
  • 118