-->
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.  [ 5 posts ] 
Author Message
 Post subject: java.lang.UnsatisfiedLinkError: SQLAllocEnv - what is this?
PostPosted: Thu Feb 17, 2005 7:26 pm 
Newbie

Joined: Thu Feb 03, 2005 4:25 pm
Posts: 7
Hello, all. I am trying to get my first POJO to map to a DB2 database. After struggling to get it set up, I now come up with this error (listed below), and I cannot fix it thus far (and I've read the pdf docs, but perhaps I'm missing it?). All my code does is this:

private static Configuration configuration;
private static SessionFactory sessionFactory;
private static Log log = LogFactory.getLog(Test.class);
static
{
try
{
configuration = new Configuration();
sessionFactory = configuration.configure().buildSessionFactory();
}
catch (Throwable t)
{
t.printStackTrace();
}
}


Hibernate version:3 beta4

Mapping documents:

Here is my hibernate.cfg.xml file:
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">

<hibernate-configuration>
<session-factory>
<property name="dialect">org.hibernate.dialect.DB2Dialect</property>
<property name="connection.driver_class">COM.ibm.db2.jdbc.app.DB2Driver</property>
<property name="connection.url">jdbc:db2:SISREP</property>
<property name="connection.username">iepxs</property>
<property name="connection.password">tw0=0n3</property>

<!-- Print SQL to stdout. -->
<property name="show_sql">true</property>
<mapping resource="edu/asu/sis/CourseMapping.hbm.xml"/>
</session-factory>
</hibernate-configuration>


Here is my CourseMapping.hbm.xml file (referenced in the cfg file):
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping SYSTEM
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">

<hibernate-mapping package="edu.asu.sis.impl" >

<class name="edu.asu.sis.impl.CourseImpl" table="COURSE_REC" lazy="true">
<!-- Common id property. -->
<id name="courseID"
type="long"
column="P_K"
unsaved-value="null"
access="property">
</id>
</class>

</hibernate-mapping>


Full stack trace of any exception that occurs:
java.lang.UnsatisfiedLinkError: SQLAllocEnv
at COM.ibm.db2.jdbc.app.DB2Driver.SQLAllocEnv(Native Method)
at COM.ibm.db2.jdbc.app.DB2Driver.<init>(DB2Driver.java:249)
at COM.ibm.db2.jdbc.app.DB2Driver.<clinit>(DB2Driver.java:131)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:141)
.
.
.

Name and version of the database you are using:DB2 (v8)

Any help you can offer is greatly appreciated - I'm getting frustrated because I can't get past this part! Thanks.

Patrick


Top
 Profile  
 
 Post subject:
PostPosted: Thu Feb 17, 2005 10:00 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
I dont use DB2 but it appears that you don't have a DLL or something the JDBC driver needs on the path. Maybe best to try using HSQL or similar database just to get started.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Feb 21, 2005 7:19 pm 
Newbie

Joined: Thu Feb 03, 2005 4:25 pm
Posts: 7
SOLVED! I was using the Type 2 JDBC driver from IBM (at least, I think it was), and it appears that Hibernate requires the Type 4 JDBC driver. So, I used the following:

db2java.jar
db2jcc.jar
db2jcc_license_cu.jar

I also had to change this line in the hibernate.cfg.xml file:

FROM:
<property name="connection.driver_class">COM.ibm.db2.jdbc.app.DB2Driver</property>

TO:
<property name="connection.driver_class">com.ibm.db2.jcc.DB2Driver</property>

Now it works! YES!

Patrick


Top
 Profile  
 
 Post subject:
PostPosted: Tue Aug 23, 2005 12:11 pm 
Newbie

Joined: Fri Apr 01, 2005 5:46 pm
Posts: 1
Hi Patrick,

Thanks so much for posting the solution you found - I ran into the same problem when upgrading from version 7 to version 8 of DB2, and your solution was really helpful for putting me on the right track. In my case all I had to do was replace db2java.zip and that did the trick.

Thanks,
Anne Marie

-------------
Anne Marie Simmie
Bioinformatics Associate
Protana Inc.
Toronto, ON


Top
 Profile  
 
 Post subject:
PostPosted: Mon Dec 26, 2005 10:21 pm 
Newbie

Joined: Mon Dec 26, 2005 9:52 pm
Posts: 3
Hello, all. I am using DB2 7.0.5 and Hibernate. I now come up with this error:
java.lang.NoSuchFieldError: indicators
at COM.ibm.db2.jdbc.app.DB2Driver.SQLAllocEnv(Native Method)
at COM.ibm.db2.jdbc.app.DB2Driver.<init>(DB2Driver.java:249)
at COM.ibm.db2.jdbc.app.DB2Driver.<clinit>(DB2Driver.java:131)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:141)
at org.hibernate.connection.DriverManagerConnectionProvider.configure(DriverManagerConnectionProvider.java:57)
at org.hibernate.connection.ConnectionProviderFactory.newConnectionProvider(ConnectionProviderFactory.java:80)
at org.hibernate.cfg.SettingsFactory.createConnectionProvider(SettingsFactory.java:362)
at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:60)
at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:1463)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1004)
at com.app.cfg.SessionFactory.currentSession(SessionFactory.java:49)

Can you help me?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 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.