Search code examples
javaderby

Derby db: how to find string in Blob field


I want to find a String withing Blob field, in my derby DB. Please provide an example or a workaround. I need this to be done at the db level, rather than retrieving the Blob field and then searching. Thanks in advance.


Solution

  • I am fairly certain this can't be done at the db level. A BLOB is fairly opaque to the DB system. When you make a blob field you are basically telling the DB, "this is a big binary field, I don't need you to know anything about it, I'll deal with it." To find the string in the blob you'd need to pull the data from the blob and search in java.

    If your data is always a string then you could look into using a VARCHAR instead.