-->
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.  [ 11 posts ] 
Author Message
 Post subject: Problem with DB2
PostPosted: Fri Nov 07, 2003 1:08 pm 
Regular
Regular

Joined: Wed Nov 05, 2003 10:57 pm
Posts: 96
I working on a demo with Hibernate. Everything worked fine with MySQL-4.0.16 with the driver com.mysql.jdbc.Driver. The same demo failed on DB2 UDB 7.2 on Linux with the driver COM.ibm.db2.jdbc.app.DB2Driver. Below is the exception thrown (on the line sessionFactory = cfg.buildSessionFactory();):

java.lang.AbstractMethodError: COM.ibm.db2.jdbc.app.DB2DatabaseMetaData.supportsResultSetType(I)Z
at net.sf.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:170)
at net.sf.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:627)
at com.westfieldgrp.wescom.hibernate.HibernateSession.currentSession(HibernateSession.java:51)

Thank you.

mota


Top
 Profile  
 
 Post subject:
PostPosted: Fri Nov 07, 2003 1:09 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
run the batch file that switches to JDBC2 support


Top
 Profile  
 
 Post subject:
PostPosted: Fri Nov 07, 2003 1:48 pm 
Regular
Regular

Joined: Wed Nov 05, 2003 10:57 pm
Posts: 96
Thank you for your prompt reply.

I updated the JDBC level, and I am now getting a different exception:

Nov 7, 2003 12:42:58 PM net.sf.hibernate.impl.SessionFactoryImpl <init>
INFO: building session factory
Nov 7, 2003 12:42:58 PM net.sf.hibernate.dialect.Dialect <init>
INFO: Using dialect: net.sf.hibernate.dialect.DB2Dialect
Nov 7, 2003 12:42:58 PM net.sf.hibernate.connection.DriverManagerConnectionProvider configure
INFO: Hibernate connection pool size: 10
java.lang.NoSuchFieldError: batchReturn
at COM.ibm.db2.jdbc.app.DB2Driver.SQLAllocEnv(Native Method)
at COM.ibm.db2.jdbc.app.DB2Driver.<init>(DB2Driver.java:244)
at COM.ibm.db2.jdbc.app.DB2Driver.<clinit>(DB2Driver.java:129)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:130)
at net.sf.hibernate.connection.DriverManagerConnectionProvider.configure(DriverManagerConnectionProvider.java:52)
at net.sf.hibernate.connection.ConnectionProviderFactory.newConnectionProvider(ConnectionProviderFactory.java:83)
at net.sf.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:153)
at net.sf.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:627)


Top
 Profile  
 
 Post subject:
PostPosted: Fri Nov 07, 2003 2:20 pm 
Regular
Regular

Joined: Wed Nov 05, 2003 10:57 pm
Posts: 96
Problem solved. I had the wrong db2java.zip in my classpath.

Thank you.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Nov 10, 2003 9:37 pm 
Beginner
Beginner

Joined: Tue Sep 23, 2003 5:00 pm
Posts: 40
Hi,

I also have problems with DB2. My mapping works well with MySQL and almost well except without 2 of my 28 classes when I try it with DB2. I can't fix the problem, maybe I should :
gavin wrote:
run the batch file that switches to JDBC2 support

But I don't know how to do it ... could you be a little bit more explicit ?

sylvain_2020


Top
 Profile  
 
 Post subject:
PostPosted: Mon Nov 10, 2003 9:43 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
There is a batch file called something like java12.bat or something in your db2 install directory. Are you sure this is the problem?? What exception are you getting?


Top
 Profile  
 
 Post subject:
PostPosted: Mon Nov 10, 2003 9:47 pm 
Beginner
Beginner

Joined: Tue Sep 23, 2003 5:00 pm
Posts: 40
No, I am not sure at all .. but I can't understand where the problem is from.

Here is the SQL generated and the error message:

Quote:
Hibernate: insert into direccionentragadest (CLAVE, RAZONSOCIAL, ABREVIACION, NOEXTERIOR, NOINTERIOR, CODIGOPOSTAL, CALLE, COLONIA, CIUDAD, CONTACTO, TELEFONO, FAX, DIRECCIONENTRAGADESTID) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, default)
10-nov-2003 19:02:48 net.sf.hibernate.util.JDBCExceptionReporter logExceptions
ADVERTENCIA: SQL Error: -302, SQLState: 22001
10-nov-2003 19:02:48 net.sf.hibernate.util.JDBCExceptionReporter logExceptions
GRAVE: DB2 SQL error: SQLCODE: -302, SQLSTATE: 22001, SQLERRMC:
10-nov-2003 19:02:48 net.sf.hibernate.JDBCException <init>
GRAVE: Could not insert
com.ibm.db2.jcc.c.SQLException: DB2 SQL error: SQLCODE: -302, SQLSTATE: 22001, SQLERRMC:
at com.ibm.db2.jcc.c.cf.d(cf.java:988)
at com.ibm.db2.jcc.a.be.k(be.java:312)
at com.ibm.db2.jcc.a.be.a(be.java:61)
at com.ibm.db2.jcc.a.s.a(s.java:64)
at com.ibm.db2.jcc.a.br.c(br.java:222)
at com.ibm.db2.jcc.c.cg.E(cg.java:1118)
at com.ibm.db2.jcc.c.cg.a(cg.java:1528)
at com.ibm.db2.jcc.c.cg.executeUpdate(cg.java:331)
at net.sf.hibernate.persister.EntityPersister.insert(EntityPersister.java:472)
at net.sf.hibernate.impl.SessionImpl.doSave(SessionImpl.java:719)
at net.sf.hibernate.impl.SessionImpl.save(SessionImpl.java:607)
at com.logis.proyecto.persistence.PersistentHandler.create(PersistentHandler.java:35)
at com.logis.proyecto.persistence.DireccionEntragaDestHandler.createDireccionEntragaDest(DireccionEntragaDestHandler.java:24)
at com.logis.proyecto.persistence.DireccionEntragaDestHandler.main(DireccionEntragaDestHandler.java:106)
Ya
com.ibm.db2.jcc.c.SQLException: DB2 SQL error: SQLCODE: -302, SQLSTATE: 22001, SQLERRMC:
at com.ibm.db2.jcc.c.cf.d(cf.java:988)
at com.ibm.db2.jcc.a.be.k(be.java:312)
at com.ibm.db2.jcc.a.be.a(be.java:61)
at com.ibm.db2.jcc.a.s.a(s.java:64)
at com.ibm.db2.jcc.a.br.c(br.java:222)
at com.ibm.db2.jcc.c.cg.E(cg.java:1118)
at com.ibm.db2.jcc.c.cg.a(cg.java:1528)
at com.ibm.db2.jcc.c.cg.executeUpdate(cg.java:331)
at net.sf.hibernate.persister.EntityPersister.insert(EntityPersister.java:472)
at net.sf.hibernate.impl.SessionImpl.doSave(SessionImpl.java:719)
at net.sf.hibernate.impl.SessionImpl.save(SessionImpl.java:607)
at com.logis.proyecto.persistence.PersistentHandler.create(PersistentHandler.java:35)
at com.logis.proyecto.persistence.DireccionEntragaDestHandler.createDireccionEntragaDest(DireccionEntragaDestHandler.java:24)
at com.logis.proyecto.persistence.DireccionEntragaDestHandler.main(DireccionEntragaDestHandler.java:106)
rethrown as net.sf.hibernate.JDBCException: Could not insert: DB2 SQL error: SQLCODE: -302, SQLSTATE: 22001, SQLERRMC:
at net.sf.hibernate.impl.SessionImpl.doSave(SessionImpl.java:722)
at net.sf.hibernate.impl.SessionImpl.save(SessionImpl.java:607)
at com.logis.proyecto.persistence.PersistentHandler.create(PersistentHandler.java:35)
at com.logis.proyecto.persistence.DireccionEntragaDestHandler.createDireccionEntragaDest(DireccionEntragaDestHandler.java:24)
at com.logis.proyecto.persistence.DireccionEntragaDestHandler.main(DireccionEntragaDestHandler.java:106)
Caused by: com.ibm.db2.jcc.c.SQLException: DB2 SQL error: SQLCODE: -302, SQLSTATE: 22001, SQLERRMC:
at com.ibm.db2.jcc.c.cf.d(cf.java:988)
at com.ibm.db2.jcc.a.be.k(be.java:312)
at com.ibm.db2.jcc.a.be.a(be.java:61)
at com.ibm.db2.jcc.a.s.a(s.java:64)
at com.ibm.db2.jcc.a.br.c(br.java:222)
at com.ibm.db2.jcc.c.cg.E(cg.java:1118)
at com.ibm.db2.jcc.c.cg.a(cg.java:1528)
at com.ibm.db2.jcc.c.cg.executeUpdate(cg.java:331)
at net.sf.hibernate.persister.EntityPersister.insert(EntityPersister.java:472)
at net.sf.hibernate.impl.SessionImpl.doSave(SessionImpl.java:719)
... 4 more


Thank you for answering so quickly
sylvain_2020


Top
 Profile  
 
 Post subject:
PostPosted: Mon Nov 10, 2003 9:56 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
hummm thats a wierd one.

find out what -302 is from the DB2 doco....


Top
 Profile  
 
 Post subject:
PostPosted: Mon Nov 10, 2003 10:12 pm 
Beginner
Beginner

Joined: Tue Sep 23, 2003 5:00 pm
Posts: 40
what a dummy am I ! I tried to put a string of 11 characters in a field typed "varchar(10)".

Quote:
Queries that returned SQLCODE '-302' with SQLSTATE '22001', String too long and number too large for target


Hopefully, DB2 seems to care more about type definition than MySQL.

Thank you for your help.

sylvain_2020


Top
 Profile  
 
 Post subject:
PostPosted: Fri Sep 23, 2005 7:20 am 
Newbie

Joined: Fri Sep 23, 2005 6:46 am
Posts: 12
gavin wrote:
run the batch file that switches to JDBC2 support

Can you please elaborate how this is done?
Thanks!


Top
 Profile  
 
 Post subject:
PostPosted: Thu Sep 29, 2005 4:46 am 
Newbie

Joined: Fri Sep 23, 2005 6:46 am
Posts: 12
To answer my own question>

Run the batch file in SQLLIB\java12
For anyone who got stauck where I did.


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