java - How to use hibernate with ms access? -
this question has answer here:
- removal of jdbc odbc bridge in java 8 6 answers
i created project in netbeans. required connect ms access db using hibernate. include jars like...
commons-lang-2.6.jar commons-logging-1.1.3.jar hsqldb.jarhsqldb.jar jackcess-2.0.4.jar ucanaccess-2.0.8.jar
and create driver odbc ms access db . code hibernate.cfg.xml.
<property name="hibernate.dialect">org.hibernate.dialect.sqlserverdialect</property> <property name="hibernate.connection.driver_class">sun.jdbc.odbc.jdbcodbcdriver</property> <property name="hibernate.connection.url">jdbc:odbc:driver={microsoft access driver (*.mdb, *.accdb)};dbq=e:/mydb.accdb</property> <property name="hibernate.connection.username">root</property>
but show following errors.....
exception in thread "awt-eventqueue-0" org.hibernate.boot.registry.classloading.spi.classloadingexception: unable load class [sun.jdbc.odbc.jdbcodbcdriver] @ org.hibernate.boot.registry.classloading.internal.classloaderserviceimpl.classforname(classloaderserviceimpl.java:245) @ org.hibernate.boot.registry.classloading.internal.classloaderserviceimpl.classforname(classloaderserviceimpl.java:245) @ org.hibernate.engine.jdbc.connections.internal.drivermanagerconnectionproviderimpl.loaddriverifpossible(drivermanagerconnectionproviderimpl.java:200) @ org.hibernate.engine.jdbc.connections.internal.drivermanagerconnectionproviderimpl.buildcreator(drivermanagerconnectionproviderimpl.java:156) @ org.hibernate.engine.jdbc.connections.internal.drivermanagerconnectionproviderimpl.configure(drivermanagerconnectionproviderimpl.java:95)
i think error message clear:
unable load class [sun.jdbc.odbc.jdbcodbcdriver]
your program cannot find class sun.jdbc.odbc.jdbcodbcdriver
.
the jdbc-odbc-bridge deprecated , removed in java 8.
Comments
Post a Comment