3

I have an MS-Access database, which I am connecting to in Java using the JDBC (I think the JDBC-ODBC bridge). My access database has some values which are in hebrew.

When I try to read these values using String str = rs.getString(1) (rs is a RowSet), the string I get is just a string of question marks.

I have other strings in hebrew, which I set in the Java code using string literals, and they work fine. So I'm pretty sure the problem is specifically with reading from the db.

I'm very new to this whole thing, so I could easily be missing something stupid... I searched Google for a while and didn't come up with anything, except some people saying that there's a chance this kind of thing is not supported (say somewhere that the JDBC-ODBC bridge has a bug with regards to Unicode, but it was from 2005, so who knows?).

I'd appreciate any help, thanks.

1 Answer 1

2

Have you tried to set the charSet prior to calling the query?

Refer to: https://docs.oracle.com/javase/1.5.0/docs/guide/jdbc/bridge.html.

Sign up to request clarification or add additional context in comments.

4 Comments

My previous comment seems to have been deleted? Not sure why. I tried setting the charSet to various things (including utf-8 and utf-16). They either didn't work or gave me a IllegalArgumentException. However, using your link I tried another encoding, which seems to have done the trick (windows-hebrew). Is this the correct way to work? It seems to me like I'd prefer unicode over flat-out specifying that it's in hebrew.
ummm... UTF8 should work! I use utf8 for Farsi Chars. Please visit the supported encodings for more details: java.sun.com/j2se/1.4.2/docs/guide/intl/encoding.doc.html
Nope, just isn't working. When I switch from windows-hebrew to UTF8, I get strings of ???? again. To make sure I understand, the only thing I need to do is pass JDBC an extra parameter - (charSet, "UTF8"), and that's it? Then the string I get back should be ok?
Well that is if your data is UTF8 of course! In your case though, if all data is hebrew, and windows-1255/windows-hebrew encoding is working, you should not worry about UTF8 then. Sorry I missed the fact that all data may be hebrew.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.