String Array field access from Java code

,

Hello there,
I try to access String Array field from Java code using JDBC. The result seem to show-up as a single indexed value with each array index value separated by single quote (For ex: Array(“apple”, “orange”, “peaches”) would show-up as Array(“apple’orange’peaches”). But the datatype is Array (based on java.sql.Types — ARRAY/2003).
The same code works fine for Numeric Array values. I can confirm that the data is stored correctly in CDB too.

Please advice
Muthu

Hi Muthu,

Can you please provide a simple way to reproduce this condition? A short Java program would be ideal.

Thanks,
Jordan Lewis

Hello Jordan Lewis,

Tried to create an reproducer and identified my issue. It was related to escaping single quote. No issue to report.
For anyone else seeing this message, here is the official doc to confirm escaping single quotes.
https://www.cockroachlabs.com/docs/stable/sql-constants.html#standard-sql-string-literals

Thanks a bunch for asking me to create a reproducer :smile: .

Thanks,
Muthu

Great! Happy to help.