I have a project in eclipse (indigo) where I access SQL data using Hibernate.
I have set up a couple of classes and used annotations to manually map to the tables. I have added a driver jar file (sqljdbc4.jar) to the build path and entered the path to folder containing _sqljdbc_auth.dll_ as "native library location" under the driver jar file (in order to support integrated security).
I can access the data using JDBC connection to my SQL Server 2012, that uses integrated security and that I have defined in hibernate.cfg.xml.
As the next step, I'd like to generate classes from the remaining SQL tables automatically. So I installed Hibernate tools from JBOSS site and I'm trying to follow through the necessary steps: I've created a console configuration based on my hibernate configuration file. Now in Hibernate perspective of my project I see three items "Configuration", "Session factory" and "Database". In properties of "Configuration" I see my connection url and other settings.
However when I click on "Database" I receive an error org.hibernate.exception.JDBCConnectionException: Getting database metadata
that boils down to the Caused by: java.lang.UnsatisfiedLinkError: no sqljdbc_auth in java.library.path
- it seems that the tool ignores the project setup - it picks up the jar, but not path to dll, and
- I see no way how to add the folder with dll to the java.library.path
I've tried to use set java.library.path
using hibernate.properties
file and referencing this file in console configuration. This seems to be doing half the job as in "Configuration" item now I can see the folder included in java.library.path
. However it does not change anything when I try to click on "Database" or configure a code generation configuration - still no sqljdbc_auth in java.library.path
error.
The only workaround I have found so far is to drop my dll in any folder that shows by default in java.library.path. Then I can configure the "code generation configuration" and create the classes. However 64-bit dll in the default path gets loaded and causes conflict for example when I need 32-bit version of it from another application, so I'd rather do it properly and reference as-needed.
Maybe it is possible to add the path under Classpath tab in Console Configuration, but it all looks what it says - "classpath" and say adding my folder to it does not change anything.
I'd like to know how to configure java.library.path correctly for the Hibernate tools. Any ideas? Is it possible?