NigelGordon
NigelGordon

Reputation: 59

Retrieving VARCHAR data containing commas Apache DB

I am using an Embedded Apache DB to store textual descriptions. For example: "John let Steve borrow his bike, which was a mistake." I can write it to the DB no problem, however, when I try to retrieve it using:

    SELECT evtText FROM events WHERE eventID = 54

This only works providing there is not a comma in the evtText. If the evtText contains a comma I get an SQLException. Which one depends on the word following the comma. Have got a temporary workaround by replacing the comma with -. That, however, is not a long term solution. Is it possible to escape the comma?

Upvotes: 0

Views: 32

Answers (2)

NigelGordon
NigelGordon

Reputation: 59

The problem was solved by using a PreparedStatement to insert the data in the first place.

Upvotes: 1

aookami
aookami

Reputation: 53

Try surrounding evtText with backticks

Upvotes: 0

Related Questions