Using Hibernate with MS ACCESS 2007 Database (Free JDBC Driver)

Posted by Quentin T. on Stack Overflow See other posts from Stack Overflow or by Quentin T.
Published on 2012-05-16T12:01:24Z Indexed on 2012/09/13 21:38 UTC
Read the original article Hit count: 271

1.

I want to do a reverse engineering action with the Hibernate plugin of Eclipse on a MS Access 2007 Database. I'm forced to use a existing MS Access 2007 db.

A easy solution is to buy the HXTT. But I want to use a free driver to do my work.

So I tried to apply this post : http://www.programmingforfuture.com/2011/06/how-to-use-ms-access-with-hibernate.html (That uses the SQL Server dialect and the driver sun.jdbc.odbc.JdbcOdbcDriver)

Unfortunately I have an error that nobody seems to have been on the internet:

Exception while generating code

Reason : 
org.hibernate.exception.GenericJDBCException: Error while reading primary key meta data for `c:/myaccessdb.mdb`.TableTest1

I have try to change the primary key on my MS Access DB (deleting all primary key) or to try the reverse engineering on a MS ACCESS with only one table without primary key, but I got all times the problems.

2.

The purpose of my job is to transfer daily (weekly) an Oracle 11g database with data from an existing database MS ACCESS 2007. And I thought to use a procedure (Hibernate EJB) Java to be launched automatically every week to do the data transfer. Is this is the best solution ?

Configuration :

  • sun.jdbc.odbc.JdbcOdbcDriver v???
  • Hibernate v3.4
  • Eclipse

ps: If you are a HXTT developer or seller please be indulgent with my post ;). Making money by making people believe that you help, it's bad !


A solution is to use Derby Client driver, as the solution in the post: Does anyone know if Hibernate and java will work effectively with Access?

But a clarification of the answer of Rich Seller is required. Could you explain your answer and explain your configuration (hibernate.cfg.xml, persistence.xml and what URL you use in the property name="hibernate.connection.url") without using paying HXTT driver but with the free Derby driver.

© Stack Overflow or respective owner

Related posts about hibernate

Related posts about ms-access