Bug #42931 cannot migrate from MS Access database
Submitted: 17 Feb 2009 13:06 Modified: 16 Apr 2013 7:19
Reporter: Wang Lei Email Updates:
Status: Can't repeat Impact on me:
None 
Category:Connector / J Severity:S2 (Serious)
Version:1.1.12 OS:Windows (5.1 2600)
Assigned to: CPU Architecture:Any
Tags: access, gbk, MySQL, utf8

[17 Feb 2009 13:06] Wang Lei
Description:
hi, i am from china,
my OS is Windows XP Simplified Chinese Edition,
first, if default charset is set gbk,
when go to the step "Connecting to Services", "connecting to source database system" fails, an error has occured as shown:

Connecting to source database and retrieve schemata names.
Create a dummy schema list because Access only has one schema for each file.
Return schemata list.
Schemata names retrieved successfully.
Initializing JDBC driver ... 
Driver class MySQL JDBC Driver 5.0
Opening connection ... 
Connection jdbc:mysql://localhost:3306/?user=root&password=mysql&useServerPrepStmts=false&characterEncoding=UTF-8
The connection to the target database could not be established (error: 0).
ReverseEngineeringMysqlJdbc.getVersion :Unsupported character encoding 'GBK'.
Details: 
com.mysql.jdbc.SQLError.createSQLException(SQLError.java:910)
com.mysql.jdbc.StringUtils.getBytes(StringUtils.java:513)
com.mysql.jdbc.StringUtils.getBytes(StringUtils.java:614)
com.mysql.jdbc.Buffer.writeStringNoNull(Buffer.java:655)
com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1628)
com.mysql.jdbc.Connection.execSQL(Connection.java:3170)
com.mysql.jdbc.Connection.configureClientCharacterSet(Connection.java:2392)
com.mysql.jdbc.Connection.initializePropsFromServer(Connection.java:3913)
com.mysql.jdbc.Connection.createNewIO(Connection.java:2683)
com.mysql.jdbc.Connection.<init>(Connection.java:1531)
com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:266)
java.sql.DriverManager.getConnection(Unknown Source)
java.sql.DriverManager.getConnection(Unknown Source)
com.mysql.grt.modules.ReverseEngineeringGeneric.establishConnection(ReverseEngineeringGeneric.java:141)
com.mysql.grt.modules.ReverseEngineeringGeneric.getVersion(ReverseEngineeringGeneric.java:161)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
java.lang.reflect.Method.invoke(Unknown Source)
com.mysql.grt.Grt.callModuleFunction(Unknown Source)

second, if default charset is set utf8,
when go to the step "Reverse Engineering", "reverse engineering" fails, an error has occured as shown:
Initializing JDBC driver ... 
Driver class MS Access
Opening connection ... 
Connection jdbc:odbc:Driver={Microsoft Access Driver (*.mdb)};DBQ=E:\My_Document\Northwind 2007.accdb;DriverID=22;READONLY=true;UID=;PWD=}
The schema could not be reverse engineered (error: 0).
ReverseEngineeringAccess.reverseEngineer :GBK
Details: 
java.nio.charset.Charset.forName(Unknown Source)
sun.jdbc.odbc.JdbcOdbcObject.CharsToBytes(Unknown Source)
sun.jdbc.odbc.JdbcOdbc.SQLDriverConnect(Unknown Source)
sun.jdbc.odbc.JdbcOdbcConnection.initialize(Unknown Source)
sun.jdbc.odbc.JdbcOdbcDriver.connect(Unknown Source)
java.sql.DriverManager.getConnection(Unknown Source)
java.sql.DriverManager.getConnection(Unknown Source)
com.mysql.grt.modules.ReverseEngineeringGeneric.establishConnection(ReverseEngineeringGeneric.java:141)
com.mysql.grt.modules.ReverseEngineeringAccess.reverseEngineer(ReverseEngineeringAccess.java:92)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
java.lang.reflect.Method.invoke(Unknown Source)
com.mysql.grt.Grt.callModuleFunction(Unknown Source)

How to repeat:
first, if default charset is set gbk,
when go to the step "Connecting to Services", "connecting to source database system" fails, an error has occured as shown:
...

second, if default charset is set utf8,
when go to the step "Reverse Engineering", "reverse engineering" fails, an error has occured as shown:
...
[17 Feb 2009 14:07] Susanne Ebrecht
Many thanks for writing a bug report.

This is JDBC related.

I changed category.
[17 Feb 2009 14:17] Susanne Ebrecht
Which version of MySQL Connector JDBC are you using?
[18 Feb 2009 13:00] Wang Lei
mysql-connector-java-5.0.4-bin.jar

thanks for your answer!
sorry for my bad english.
[18 Feb 2009 13:23] Susanne Ebrecht
Many thanks for your fast feedback.

The connector you are using is more then 3 years old.

Usually there should not be a problem with GBK in newer connectors.

Please try newer JDBC connector. Our actual version is 5.1.7

You can download it here:
http://dev.mysql.com/downloads/connector/j/5.1.html
[18 Feb 2009 15:42] Wang Lei
i used the mysql jdbc connector 5.1.17 downloaded just now (copy 5.1.17 to the directory "MySQL_GUI_Tools_V5.0\java\lib", delete 5.0.4, is this way right?) , error occured as before.

i don't know where i could find which mysql jdbc connector i am using.
[19 Feb 2009 11:27] Wang Lei
i am using the original edition downloaded from the mysql official website, that is "mysql-gui-tools-noinstall-5.0-r12-win32", and do not change anything, any questions?
[20 May 2009 14:47] Tonci Grgin
Hi Wang.

This all looks like your JVM does not support GBK. As you can see in http://java.sun.com/j2se/1.4.2/docs/guide/intl/encoding.doc.html, GBK is supported but only on newer JVM's with Extended Encoding Set (contained in lib/charsets.jar). So, can you:
  o make sure you have new JAR and full install *with* charsets.jar in lib directory
  o make sure that's the JAR workbench is picking up
If all seems ok, please make small GBK test case like this and run it:
    System.our.println("some_free_text".getBytes("GBK"))
and see if it runs without errors.

Only after you can confirm that
  a) your JRE supports GBK
and
  b) your workbench is picking *that* JRE
you should come back to us with details.
[20 Jun 2009 23:00] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
[16 Apr 2013 7:19] Alexander Soklakov
Hi Wang.

There is no feedback since June 2009, so I close the report as "Can't repeat". Please, feel free to reopen it if problem still exists.