使用 JDBC 从 Access 数据库读取 Unicode 数据

发布于 2024-08-05 03:29:28 字数 398 浏览 3 评论 0原文

我有一个 MS-Access 数据库,我使用 JDBC(我认为是 JDBC-ODBC 桥)在 Java 中连接到该数据库。我的访问数据库有一些希伯来语值。

当我尝试使用 String str = rs.getString(1) (rs 是 RowSet)读取这些值时,我得到的字符串只是一串问号。

我还有其他希伯来语字符串,我使用字符串文字在 Java 代码中设置它们,并且它们工作正常。所以我很确定问题出在从数据库读取数据上。

我对这整件事很陌生,所以我很容易会错过一些愚蠢的东西......我在谷歌上搜索了一段时间,但没有想到任何东西,除了有些人说这种事情可能不是支持(比如说 JDBC-ODBC 桥在 Unicode 方面有一个错误,但它是从 2005 年开始的,所以谁知道呢?)。

我将不胜感激任何帮助,谢谢。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

入怼 2024-08-12 03:29:28

您是否尝试在调用查询之前设置字符集?

参考:https://docs.oracle.com /javase/1.5.0/docs/guide/jdbc/bridge.html

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文