[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] Microsoft Access Encoding


   I had the same issue with Sybase for string like oe = 338(UC)/339(LC) - this is standard default behavior and is related to your DB itself.  You have 2 or more options.  Use NVARCHAR to handle DBCS characters (those over 255) - this will increase your column size by 2 even for latin char data.  Or make the database encoding UTF-8 to match the ORM layer.



   Telus Health



From: eclipselink-users-bounces@xxxxxxxxxxx [mailto:eclipselink-users-bounces@xxxxxxxxxxx] On Behalf Of Stefan Teitge
Sent: Tuesday, November 20, 2012 3:33 PM
To: eclipselink-users@xxxxxxxxxxx
Subject: [eclipselink-users] Microsoft Access Encoding




I try to load data from a Microsoft Access Database in Windows 7.

I use EclipseLink JPA 2.4.1.


Map<String, String> props = new HashMap<String, String>();

props.put(PersistenceUnitProperties.JDBC_DRIVER, "sun.jdbc.odbc.JdbcOdbcDriver");

props.put(PersistenceUnitProperties.JDBC_URL, "jdbc:odbc:mydb");

props.put(PersistenceUnitProperties.TARGET_DATABASE, "org.eclipse.persistence.platform.database.AccessPlatform");

// is this parameter for JDBC-ODBC bridge used???

props.put("charSet", "iso-8859-1"); 


EntityManagerFactory emf = Persistence.createEntityManagerFactory("foo", props);

em = emf.createEntityManager();


If I query my database (e.g. em.find(StringTable.class, 7)) my text encoding is destroyed in string properties in the entity. Strings like "Müller" result in in Java string like "M?ller",


It is for sure an encoding issue. But at which point or using which property do I set the correct encoding for the Access Database?



Stefan Teitge