-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 8 posts ] 
Author Message
 Post subject: Hibernate Console: Problems loading acs.jdbc.Driver
PostPosted: Wed Apr 20, 2005 2:09 pm 
Newbie

Joined: Wed Apr 20, 2005 1:33 pm
Posts: 6
Greetings,

I am using HibernateConsole 3.0 alpha 1, Eclipse 3.1M6, aveConnect 1.1 for MS Access as my JDBC driver on Windows XP

See: http://www.aveconnect.com/jdbc-driver-MS-Access.htm

My goal is to create Hibernate Artifacts from my Microsoft Access database, using "Reverse Engineer from JDBC Connection" and "Generate domain code."

I have made sure to give user "Admin" read permissions on the table mSysObjects, which holds meta-data on tables in the *.mdb file.

Here is the error window I am seeing:

http://ourworld.cs.com/cyranoVR/hibernateError.JPG

"Error under artifact generation:

Reason: org.hibernate.console.HibernateConsoleRuntimeException:Problems while loading database driverclass(acs.jdbc.Driver)"


Here is my Hibernate.properties file:

hibernate.connection.driver_class=acs.jdbc.Driver
hibernate.connection.url=jdbc:atinav:localhost:7227:c:\\data\test.mdb
hibernate.connection.username=Admin
hibernate.connection.password=
hibernate.connection.pool_size=40
hibernate.dialect=org.hibernate.GenericDialect


QUESTIONS:

1) Is there a recommended third-party jdbc driver driver for Microsoft Access and hibernate? The standard sun JDBC driver does not provide adequate meta-data from Access DBs.

2) I have explicitly imported the classpath to acs.jdbc.Driver in my Hibernate console configuration. Is there some setting that I should fix so that it can properly load the driver?


Top
 Profile  
 
 Post subject:
PostPosted: Thu Apr 21, 2005 12:05 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
I did not know a JDBC driver (other than the ODBC bridge) existed - interesting. I dont have an answer through I would guess a class path issue of some form or the driver is looking for something. I would see if you can get it to work with a simple connection procedure and do a few meta data queries to make sure that basic functionality works first.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Apr 21, 2005 1:44 pm 
Newbie

Joined: Wed Apr 20, 2005 1:33 pm
Posts: 6
Ok, I did some meta-data queries using the native jdbc MS Access driver:

Code:
String database = "jdbc:atinav:localhost:7227:c:\\data\\test.mdb";
Class.forName("acs.jdbc.Driver");
conn = DriverManager.getConnection(database);
         
Statement stm = conn.createStatement();
ResultSet rst = stm.executeQuery("SELECT * FROM mSysObjects");
if (rst.next()) {
   while(rst.next())
       System.out.println(rst.getString("Name"));
}


This successfully returned a list of all the objects (tables, views, forms, etc) in the database.

Of course, now I am trying to use the Generate Hibernate Artifact and encountering other problems, namely "DialectClass Not found:xxxDialect" where xxx is Generic, SQLServer, or whatever. I'm sure this is just some oversight or typo on my part tho...

Well, I guess I will just have to do the mappings by hand ;) Let me know if you figure something out from this info...

- CVR


Top
 Profile  
 
 Post subject:
PostPosted: Thu Apr 21, 2005 2:05 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
you need to show the full staktrace its availble in the Error log view

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Thu Apr 21, 2005 4:16 pm 
Newbie

Joined: Wed Apr 20, 2005 1:33 pm
Posts: 6
max wrote:
you need to show the full staktrace its availble in the Error log view


First of all - you should know that I am using eclipse.buildId=I20050401-1645

Back to the problem with JDBC-ODBC connections to Access. The reason I turned to a native Access driver was because I was seeing the following error message:

http://ourworld.cs.com/cyranoVR/hiberna ... ataErr.JPG

Stacktrace:
Code:
org.hibernate.exception.JDBCConnectionException: Getting database metadata
   at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:66)
   at org.hibernate.cfg.JDBCBinder.getMetaData(JDBCBinder.java:678)
   at org.hibernate.cfg.JDBCBinder.readTables(JDBCBinder.java:566)
   at org.hibernate.cfg.JDBCBinder.readFromDatabase(JDBCBinder.java:101)
   at org.hibernate.cfg.JDBCMetaDataConfiguration.readFromJDBC(JDBCMetaDataConfiguration.java:40)
   at org.hibernate.eclipse.console.wizards.ArtifactGeneratorWizard$3.execute(ArtifactGeneratorWizard.java:213)
   at org.hibernate.console.ConsoleConfiguration.execute(ConsoleConfiguration.java:76)
   at org.hibernate.eclipse.console.wizards.ArtifactGeneratorWizard.buildConfiguration(ArtifactGeneratorWizard.java:210)
   at org.hibernate.eclipse.console.wizards.ArtifactGeneratorWizard.doFinish(ArtifactGeneratorWizard.java:147)
   at org.hibernate.eclipse.console.wizards.ArtifactGeneratorWizard.access$0(ArtifactGeneratorWizard.java:127)
   at org.hibernate.eclipse.console.wizards.ArtifactGeneratorWizard$1.run(ArtifactGeneratorWizard.java:95)
   at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:113)
Caused by: java.sql.SQLException: No suitable driver
   at java.sql.DriverManager.getConnection(Unknown Source)
   at java.sql.DriverManager.getConnection(Unknown Source)
   at org.hibernate.connection.DriverManagerConnectionProvider.getConnection(DriverManagerConnectionProvider.java:110)
   at org.hibernate.cfg.JDBCBinder.getConnnection(JDBCBinder.java:691)
   at org.hibernate.cfg.JDBCBinder.getMetaData(JDBCBinder.java:676)


So there's that. Back to the native Microsoft Access driver...

I easily resolved the "Problem Loading Class acs.jdbc.Driver" issue by importing the distribution Jar file into my project under /lib and then updating my hibernate console configuration accordlingly. Here is a screen capture:


http://ourworld.cs.com/cyranoVR/hibernateConfig.JPG

So no more "Problems loading Driverclass(acs.jdbc.Driver)" - it was a classpath issue after all. I run the Generate Artifact wizard, cross my fingers and...


Code:
java.lang.AbstractMethodError: acs.jdbc.g.supportsResultSetType(I)Z
   at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:119)
   at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:1485)
   at org.hibernate.cfg.JDBCMetaDataConfiguration.readFromJDBC(JDBCMetaDataConfiguration.java:36)
   at org.hibernate.eclipse.console.wizards.ArtifactGeneratorWizard$3.execute(ArtifactGeneratorWizard.java:213)
   at org.hibernate.console.ConsoleConfiguration.execute(ConsoleConfiguration.java:76)
   at org.hibernate.eclipse.console.wizards.ArtifactGeneratorWizard.buildConfiguration(ArtifactGeneratorWizard.java:210)
   at org.hibernate.eclipse.console.wizards.ArtifactGeneratorWizard.doFinish(ArtifactGeneratorWizard.java:147)
   at org.hibernate.eclipse.console.wizards.ArtifactGeneratorWizard.access$0(ArtifactGeneratorWizard.java:127)
   at org.hibernate.eclipse.console.wizards.ArtifactGeneratorWizard$1.run(ArtifactGeneratorWizard.java:95)
   at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:113)


So it seems that the acs.jdbc.Driver doesn't implement the MetaData methods that Hibernate needs to do its job...ah well.

I'm kinda suprised that the Sun jdbc-odbc bridge has problems interacting with Microsoft Access databases. I think the answer we're heading towards is: "don't use Access."

Still, my employer has a large installed base of Access applications. It would be nice to get them on the intranet with java so we can keep all the gui stuff, and without having to export them to some other db platform. I wonder: is shouldn't Hibernate play nice with MS Access?


Top
 Profile  
 
 Post subject:
PostPosted: Thu Apr 21, 2005 4:19 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
we play nice with anything that implements jdbc properly.

apparently access jdbc driver does not so not much i can do ;(

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Thu Apr 21, 2005 10:28 pm 
Newbie

Joined: Wed Apr 20, 2005 1:33 pm
Posts: 6
max wrote:
we play nice with anything that implements jdbc properly.

apparently access jdbc driver does not so not much i can do ;(

Whoops, seems I indeed got that one backwards ;)


Top
 Profile  
 
 Post subject:
PostPosted: Thu Apr 21, 2005 10:49 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
Your employer would have its reasons but I would go to MSSQL rather than use Access as a back end. Its a very easy conversion process. If you do, don't use MS's JDBC driver, use jTDS - it works quite well.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 8 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.