views:

544

answers:

3

Hello,

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.

A: 

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

Refer to: http://java.sun.com/j2se/1.4.2/docs/guide/jdbc/bridge.html

Mohammad
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.
Edan Maor
ummm... UTF8 should work! I use utf8 for Farsi Chars. Please visit the supported encodings for more details: http://java.sun.com/j2se/1.4.2/docs/guide/intl/encoding.doc.html
Mohammad
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?
Edan Maor
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.
Mohammad
A: 

I have the same question Edan or Mohammad.....but i have prob in passing the parameter to JDBC....

can u plss give me demo of how to pass the parameter to JDBC......plss

thanks in advance

Kamlesh
Why don't you post a new question an refer to this one? It's very easy for people to miss your question if you post it as an "answer" to someone else's question. If you want good answers, you should not just post the bare question, but also include some of the code from your own efforts, to show that you're actually working on the problem yourself, and not just expecting to be handed the answer on a silver platter.
David-W-Fenton
A: 

plz send how to connect with uniccode

anil