JDK-6345277 : JDBC-ODBC Bridge still does not support Unicode UTF-16
  • Type: Enhancement
  • Component: core-libs
  • Sub-Component: java.sql:bridge
  • Affected Version: 5.0
  • Priority: P4
  • Status: Closed
  • Resolution: Won't Fix
  • OS: windows_xp
  • CPU: x86
  • Submitted: 2005-11-03
  • Updated: 2014-02-27
  • Resolved: 2013-04-12
Description
FULL PRODUCT VERSION :
java version "1.5.0_01"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_01-b08)
Java HotSpot(TM) Client VM (build 1.5.0_01-b08, mixed mode, sharing)

ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows XP [Version 5.1.2600]

A DESCRIPTION OF THE PROBLEM :
JDBC-ODBC Bridge still does not support Unicode UTF-16, which is the charset used by MS Access 2000/2003. Since the DB is installed on most Windows PC, it's naturally the one developers/users prefer for their personal desktop DB applications. A lot of Unicode/Access-related questions have been asked on Java JDBC Forum, and a few bug reports (4340942) were also submitted. It's highly desirable that this bug be fixed.

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Follow the instructions given in http://java.sun.com/j2se/1.5.0/docs/guide/jdbc/bridge.html

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
It should enable connection to MS Access 2000/2003 and allow retrieve/update of Unicode text data.
ACTUAL -
Exceptions thrown.

ERROR MESSAGES/STACK TRACES THAT OCCUR :
java.sql.SQLException:
    at sun.jdbc.odbc.JdbcOdbc.createSQLException(JdbcOdbc.java:6958)
    at sun.jdbc.odbc.JdbcOdbc.standardError(JdbcOdbc.java:7115)
    at sun.jdbc.odbc.JdbcOdbc.SQLDriverConnect(JdbcOdbc.java:3074)
    at sun.jdbc.odbc.JdbcOdbcConnection.initialize(JdbcOdbcConnection.java:323)
    at sun.jdbc.odbc.JdbcOdbcDriver.connect(JdbcOdbcDriver.java:174)
    at java.sql.DriverManager.getConnection(DriverManager.java:525)
    at java.sql.DriverManager.getConnection(DriverManager.java:140)

REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
       // Load the JDBC-ODBC bridge driver
       Class.forName(sun.jdbc.odbc.JdbcOdbcDriver) ;
       String url = "jdbc:odbc:Driver={Microsoft Access Driver (*.mdb)};DBQ=Northwind.mdb";

       // setup the properties
       java.util.Properties prop = new java.util.Properties();
       prop.put("charSet", "UTF-16");
       prop.put("user", username);
       prop.put("password", password);
 
       // Connect to the database
       con = DriverManager.getConnection(url, prop);
---------- END SOURCE ----------

CUSTOMER SUBMITTED WORKAROUND :
No workaround.

Alternative charsets, such as UnicodeBig, UnicodeLittle, produced the same exceptions.

UTF8 yielded the connection, but since Access DB charset is UTF-16, the data were retrieved/updated corrupted.

Comments
The bridge has been removed from Java SE 8 and is not supported
2013-04-12

EVALUATION This is targetted for next JDK release i.e. JDK 7.0. This is not targetted for mustang
2006-03-24