United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: JDK-6345277 JDBC-ODBC Bridge still does not support Unicode UTF-16
JDK-6345277 : JDBC-ODBC Bridge still does not support Unicode UTF-16

Details
Type:
Enhancement
Submit Date:
2005-11-03
Status:
Closed
Updated Date:
2014-02-27
Project Name:
JDK
Resolved Date:
2013-04-12
Component:
core-libs
OS:
windows_xp
Sub-Component:
java.sql:bridge
CPU:
x86
Priority:
P4
Resolution:
Won't Fix
Affected Versions:
5.0
Fixed Versions:

Related Reports

Sub Tasks

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
EVALUATION

This is targetted for next JDK release i.e. JDK 7.0. 
This is not targetted for mustang
                                     
2006-03-24
The bridge has been removed from Java SE 8 and is not supported
                                     
2013-04-12



Hardware and Software, Engineered to Work Together