Skip to main content

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

I don't know MS access, but if charSet is the property you need to pass to the database connection, you will need append the PersistenceUnitProperties.JDBC_PROPERTY prefix "eclipselink.jdbc.property." to have EclipseLink pass it through to the driver.

Try adding adding:
 props.put("eclipselink.jdbc.property.charSet", "iso-8859-1");


Best Regards,
Chris




On 20/11/2012 3:32 PM, Stefan Teitge wrote:
Hello!

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?

Greets
Stefan Teitge


_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users


Back to the top