-->
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.  [ 1 post ] 
Author Message
 Post subject: Unable to execute a query on DB2 using Hibernate
PostPosted: Fri Oct 14, 2005 5:59 am 
Newbie

Joined: Fri Oct 14, 2005 5:37 am
Posts: 1
Hibernate version: 3.0.5

Mapping documents:

hibernate.cfg.xml

<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">

<!-- Generated by MyEclipse Hibernate Tools. -->
<hibernate-configuration>

<session-factory name="foo:/hibernate/SessionFactory">
<property name="show_sql">false</property>
<property name="dialect">org.hibernate.dialect.DB2Dialect</property>
<property name="connection.datasource">
java:/comp/env/jdbc/DOGCORE2
</property>
<property name="connection.username"></property>
<property name="connection.password"></property>
<mapping resource="/gebruiker.hbm.xml" />
</session-factory>

</hibernate-configuration>


gebruiker.hbm.xml

<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">

<hibernate-mapping>
<class name="web.be.ovam.alarm.struts.Gebruiker" table="GEBRUIKERS">
<id name="id" type="long" column="GEBRUIKER_ID" >
<generator class="increment"/>
</id>
<property name="naam">
<column name="NAAM" />
</property>
<property name="initialen">
<column name="INITIALEN"/>
</property>
</class>
</hibernate-mapping>


server.xml

I added the following to the server.xml

<Context path="/OVAM_Alarmen" docBase="OVAM_Alarmen"
debug="5" reloadable="true" crossContext="true">

<Resource name="jdbc/DOGCORE2" scope="Shareable" auth="Container" type="javax.sql.DataSource"
maxActive="100" maxIdle="30" maxWait="10000"
username="inuit" password="oca_app_inuit" driverClassName="COM.ibm.db2.jdbc.app.DB2Driver"
url="jdbc:db2:DOGCORE2"/>

</Context>


Code between sessionFactory.openSession() and session.close():

String SQL_QUERY ="from Gebruiker GEBRUIKERS";
Query query = session.createQuery(SQL_QUERY);
for(Iterator it=query.iterate();it.hasNext();){
Gebruiker gebruiker=(Gebruiker)it.next();
}

Full stack trace of any exception that occurs:

type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

javax.servlet.ServletException
org.apache.struts.action.RequestProcessor.processException(RequestProcessor.java:545)
org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:486)
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

root cause

java.lang.UnsupportedOperationException
org.apache.tomcat.dbcp.dbcp.PoolingDataSource.getConnection(PoolingDataSource.java:116)
org.apache.tomcat.dbcp.dbcp.BasicDataSource.getConnection(BasicDataSource.java:554)
org.hibernate.connection.DatasourceConnectionProvider.getConnection(DatasourceConnectionProvider.java:56)
org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:298)
org.hibernate.jdbc.ConnectionManager.getConnection(ConnectionManager.java:110)
org.hibernate.jdbc.AbstractBatcher.prepareQueryStatement(AbstractBatcher.java:88)
org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1162)
org.hibernate.loader.hql.QueryLoader.iterate(QueryLoader.java:410)
org.hibernate.hql.ast.QueryTranslatorImpl.iterate(QueryTranslatorImpl.java:281)
org.hibernate.impl.SessionImpl.iterate(SessionImpl.java:935)
org.hibernate.impl.QueryImpl.iterate(QueryImpl.java:41)
web.be.ovam.alarm.struts.action.LoginAction.execute(LoginAction.java:110)
org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484)
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)


Name and version of the database you are using: DB2 version 7

I have no sql query and can not find the hibernate logging.

I am new at hibernate, but I want to use it to connect to a DB2 database. I want to use datasources that are defined on the webserver.
The webserver is a Tomcat 5.5. But everytime I want to execute a query, I get the above exception.
I am able to connect to the database and execute a query using the datasources without hibernate. But using hibernate the above exception is thrown.
I have no idea what the problem is. Can somebody help me?


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

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.