-->
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.  [ 4 posts ] 
Author Message
 Post subject: DB2 CLOBs with DB2 8.1.5 - please help
PostPosted: Mon Nov 01, 2004 7:34 pm 
Newbie

Joined: Mon Nov 01, 2004 7:25 pm
Posts: 3
Are there any samples of people reading CLOBs from DB2 OS390? I am having trouble reading CLOBs. SQL0423N. NOt sure what I am doign wrong. I am using the "clob" hibernate type. Please help.
P.S. Not sure if the stack trace is of any use except for the DB2 error.
Thanks,
Hibernate version: 2.

Mapping documents:

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

Full stack trace of any exception that occurs:

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

( 11/1/04 6:17 PM );
----> nested COM.ibm.db2.jdbc.DB2Exception: [IBM][CLI Driver][DB2] SQL0423N Locator variable "001" does not currently represent any value. SQLSTATE=0F001
[slf5s.MESSAGE]
[slf5s.start]01 Nov 2004 18:17:01,773[slf5s.DATE]ERROR[slf5s.PRIORITY]200411011815421510000000007 127.0.0.1 /submiteventstatus[slf5s.NDC]SpringCommProtocol::invokeSpringMethod - InvocationTargetException: [slf5s.MESSAGE]
java.lang.reflect.InvocationTargetException:
com.cigna.ecommerce.evtmgmt.springsvc.EventReplayException: EventReplayService::replayEvent:: Error while replaying event Id: *** [IBM][CLI Driver][DB2] SQL0423N Locator variable "001" does not currently represent any value. SQLSTATE=0F001
( 11/1/04 6:17 PM );
----> nested COM.ibm.db2.jdbc.DB2Exception: [IBM][CLI Driver][DB2] SQL0423N Locator variable "001" does not currently represent any value. SQLSTATE=0F001

at com.cigna.ecommerce.evtmgmt.action.EventStatusAction.executeSubmit(EventStatusAction.java:115)
at com.cigna.ecommerce.evtmgmt.action.DefaultEvtMgmtAction.executeAction(DefaultEvtMgmtAction.java:81)
at com.cigna.framework.struts.actions.CFAction.perform(CFAction.java:237)
at com.cigna.framework.struts.actions.CFAction.execute(CFAction.java:254)
at com.cigna.ecommerce.evtmgmt.action.EvtMgmtAction.execute(EvtMgmtAction.java:261)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:423)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:233)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1166)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:417)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:787)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:854)
at com.ibm.ws.webcontainer.servlet.StrictServletInstance.doService(StrictServletInstance.java:145)
at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet._service(StrictLifecycleServlet.java:215)
at com.ibm.ws.webcontainer.servlet.IdleServletState.service(StrictLifecycleServlet.java:314)
at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet.service(StrictLifecycleServlet.java:117)
at com.ibm.ws.webcontainer.servlet.ServletInstance.service(ServletInstance.java:368)
at com.ibm.ws.webcontainer.servlet.ValidServletReferenceState.dispatch(ValidServletReferenceState.java:43)
at com.ibm.ws.webcontainer.servlet.ServletInstanceReference.dispatch(ServletInstanceReference.java:41)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:96)
at com.cigna.ecommerce.evtmgmt.filter.FauxAgentFilter.doFilter(FauxAgentFilter.java:111)
at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:150)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:96)
at com.cigna.framework.util.httpfilter.TransactionIdInsertionFilter.doFilter(TransactionIdInsertionFilter.java:75)
at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:150)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:96)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.handleWebAppDispatch(WebAppRequestDispatcher.java:1027)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.dispatch(WebAppRequestDispatcher.java:735)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.forward(WebAppRequestDispatcher.java:217)
at com.ibm.ws.webcontainer.srt.WebAppInvoker.doForward(WebAppInvoker.java:135)
at com.ibm.ws.webcontainer.srt.WebAppInvoker.handleInvocationHook(WebAppInvoker.java:229)
at com.ibm.ws.webcontainer.cache.invocation.CachedInvocation.handleInvocation(CachedInvocation.java:72)
at com.ibm.ws.webcontainer.cache.invocation.CacheableInvocationContext.invoke(CacheableInvocationContext.java:118)
at com.ibm.ws.webcontainer.srp.ServletRequestProcessor.dispatchByURI(ServletRequestProcessor.java:189)
at com.ibm.ws.webcontainer.oselistener.OSEListenerDispatcher.service(OSEListener.java:411)
at com.ibm.ws.webcontainer.http.HttpConnection.handleRequest(HttpConnection.java:57)
at com.ibm.ws.http.HttpConnection.readAndHandleRequest(HttpConnection.java:693)
at com.ibm.ws.http.HttpConnection.run(HttpConnection.java:557)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:615)
at com.ibm.ws.http.HttpConnection.run(HttpConnection.java:557)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:615)
at com.ibm.ws.webcontainer.http.HttpConnection.handleRequest(HttpConnection.java:57)
at com.ibm.ws.http.HttpConnection.readAndHandleRequest(HttpConnection.java:693)
at com.ibm.ws.http.HttpConnection.run(HttpConnection.java:557)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:615)
at com.ibm.ws.webcontainer.http.HttpConnection.handleRequest(HttpConnection.java:56)
at com.ibm.ws.http.HttpConnection.readAndHandleRequest(HttpConnection.java:610)
at com.ibm.ws.http.HttpConnection.run(HttpConnection.java:435)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:593)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:615)
COM.ibm.db2.jdbc.DB2Exception: [IBM][CLI Driver][DB2] SQL0423N Locator variable "001" does not currently represent any value. SQLSTATE=0F001

at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:138)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:68)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:138)
at com.cigna.framework.util.spring.aop.interceptor.ResultBeanDumpInterceptor.invoke(ResultBeanDumpInterceptor.java:95)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:116)
at org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:610)
at com.cigna.ecommerce.evtmgmt.springsvc.EventReplayService$$EnhancerByCGLIB$$9b554014.replayEvent(<generated>)
at java.lang.reflect.Method.invoke(Native Method)
at org.apache.commons.beanutils.MethodUtils.invokeMethod(MethodUtils.java:252)
at org.apache.commons.beanutils.MethodUtils.invokeMethod(MethodUtils.java:198)
at com.cigna.framework.service.comm.local.SpringCommProtocol.invokeSpringMethod(SpringCommProtocol.java:233)
at com.cigna.framework.service.comm.local.SpringCommProtocol.processCommand(SpringCommProtocol.java:136)
at com.cigna.framework.service.comm.IServiceClient.processCommand(IServiceClient.java:84)
at com.cigna.framework.service.ServiceManager.delegate(ServiceManager.java:373)
at com.cigna.ecommerce.evtmgmt.action.DefaultEvtMgmtAction.processEventReplay(DefaultEvtMgmtAction.java:509)
at com.cigna.ecommerce.evtmgmt.action.EventStatusAction.eventReplay(EventStatusAction.java:340)
at com.cigna.ecommerce.evtmgmt.action.EventStatusAction.executeSubmit(EventStatusAction.java:115)
at com.cigna.ecommerce.evtmgmt.action.DefaultEvtMgmtAction.executeAction(DefaultEvtMgmtAction.java:81)
at com.cigna.framework.struts.actions.CFAction.perform(CFAction.java:237)
at com.cigna.framework.struts.actions.CFAction.execute(CFAction.java:254)
at com.cigna.ecommerce.evtmgmt.action.EvtMgmtAction.execute(EvtMgmtAction.java:261)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:423)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:233)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1166)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:417)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:787)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:854)
at com.ibm.ws.webcontainer.servlet.StrictServletInstance.doService(StrictServletInstance.java:145)
at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet._service(StrictLifecycleServlet.java:215)
at com.ibm.ws.webcontainer.servlet.IdleServletState.service(StrictLifecycleServlet.java:314)
at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet.service(StrictLifecycleServlet.java:117)
at com.ibm.ws.webcontainer.servlet.ServletInstance.service(ServletInstance.java:368)
at com.ibm.ws.webcontainer.servlet.ValidServletReferenceState.dispatch(ValidServletReferenceState.java:43)
at com.ibm.ws.webcontainer.servlet.ServletInstanceReference.dispatch(ServletInstanceReference.java:41)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:96)
at com.cigna.ecommerce.evtmgmt.filter.FauxAgentFilter.doFilter(FauxAgentFilter.java:111)
at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:150)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:96)
at com.cigna.framework.util.httpfilter.TransactionIdInsertionFilter.doFilter(TransactionIdInsertionFilter.java:75)
at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:150)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:96)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.handleWebAppDispatch(WebAppRequestDispatcher.java:1027)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.dispatch(WebAppRequestDispatcher.java:735)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.forward(WebAppRequestDispatcher.java:217)
at com.ibm.ws.webcontainer.srt.WebAppInvoker.doForward(WebAppInvoker.java:135)
at com.ibm.ws.webcontainer.srt.WebAppInvoker.handleInvocationHook(WebAppInvoker.java:229)
at com.ibm.ws.webcontainer.cache.invocation.CachedInvocation.handleInvocation(CachedInvocation.java:72)
at com.ibm.ws.webcontainer.cache.invocation.CacheableInvocationContext.invoke(CacheableInvocationContext.java:118)
at com.ibm.ws.webcontainer.srp.ServletRequestProcessor.dispatchByURI(ServletRequestProcessor.java:189)
at com.ibm.ws.webcontainer.oselistener.OSEListenerDispatcher.service(OSEListener.java:411)
at com.ibm.ws.webcontainer.http.HttpConnection.handleRequest(HttpConnection.java:57)
at com.ibm.ws.http.HttpConnection.readAndHandleRequest(HttpConnection.java:693)
at com.ibm.ws.http.HttpConnection.run(HttpConnection.java:557)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:615)
at com.ibm.ws.http.HttpConnection.run(HttpConnection.java:557)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:615)
at com.ibm.ws.webcontainer.srp.ServletRequestProcessor.dispatchByURI(ServletRequestProcessor.java:189)
at com.ibm.ws.webcontainer.oselistener.OSEListenerDispatcher.service(OSEListener.java:411)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:615)


Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 02, 2004 9:49 am 
Newbie

Joined: Wed Apr 28, 2004 6:44 am
Posts: 15
Location: Amsterdam, Netherlands
Hi,

I use CLOBs with Hibernate and DB2 on OS/390, yes. Only difference is that I use some version of DB2 v7.

I only have to explicitly write them once, but I guess that behind the scenes, Hibernate does read them when I read a row of the table.

Can you show me the DDL used to create the table? Experts wiser than me have modified my OS/390 version of the DDL, adding an extra column and an auxiliary table, needed for the CLOB support on OS/390.
If you show me your DDL, I can hopefully point out to you what you need to do add if it's missing.

If that still doesn't give anything, please give me the relevant portions of your mapping document.

Also, you might want to search the website for samples of how to map CLOBs to java.lang.String, if you haven't already.

BTW, which version of Hibernate exactly are you using? I'm using version 2.1.6, with succes.

Cheers,

--Tim


Top
 Profile  
 
 Post subject: DB2 CLOBs with DB2 8.1.5 - please help
PostPosted: Tue Nov 02, 2004 10:05 am 
Newbie

Joined: Mon Nov 01, 2004 7:25 pm
Posts: 3
Hi,
Thanks for the reply. Here is the DDL. We do use an AUX table.
DDL:
CREATE TABLE user.clob_txt
(SYS_ID INTEGER NOT NULL,
ROW_ID ROWID NOT NULL GENERATED ALWAYS,
CLOB_TXT CLOB(3000000) FOR SBCS DATA NOT NULL,
LAST_TIMESTMP TIMESTAMP NOT NULL DEFAULT,
)
Mapping document:
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 2.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
<hibernate-mapping schema="USER" package="clob.bean.databean">
<class name="ClobTextBean" table="CLOB_TXT" dynamic-insert="true" dynamic-update="true" mutable="false">
<id name="SysId" column="SYS_ID" type="int">
<generator class="assigned" />
</id>
<property name="clobText" type="clob" column="CLOB_TXT" />
<property name="lastUpdtTs" type="timestamp" column="LAST_TIMESTMP" />
</class>
</hibernate-mapping>

Thanks for your help. I am using DB2 v8 fp5. It seems to be using locator by default in the background which is good. I do get the locator back but it does me no good since when I use this piece of code it doesn't seem to use it. Is Hibernate keeping any connections open when I select to read the clob? I hope not. Do you have any snippets I can look at?
String clobStr = clob.getSubString(1, (new Long(clob.length())).intValue());


Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 02, 2004 10:21 am 
Newbie

Joined: Wed Apr 28, 2004 6:44 am
Posts: 15
Location: Amsterdam, Netherlands
Hi,

With the following link you might find some help:

http://www.hibernate.org/76.html

(Or search the hibernate website for 'clob string'.)

The class from the above url does a basic usertype mapping between clob and java.lang.String, which is what I use and seems to work for me. The code on that page is not quite correct, b/c it doesn't take NULL values properly into account for instance, but there are some helpful comments at the bottom of the page and it's a useful start.


CLOBs often have a limitation in that they cannot be read after the connection is closed, or even after the JDBC resultset is closed. That makes dealing with CLOBs a bit hard from Hibernate. I don't know how large your CLOBs will typically get, and if it's a problem for you if you have to read them into memory all at once.

Anyways, a snippet of my DDL:

Code:
CREATE TABLE MESSAGE_OUT (
   MSGOUTSEQNUM INTEGER NOT NULL generated always as identity (start with 1, increment by 1, no cache),
   SFTLCK INTEGER NOT NULL,
   TIM TIMESTAMP NOT NULL,
   TX_REFPRMSCH VARCHAR ( 200 ),
   TX_REF VARCHAR ( 200 ) NOT NULL,
   XMLMSGOUT CLOB ( 256k ) NOT NULL,
   SECID ROWID NOT NULL GENERATED BY DEFAULT,   
   CONSTRAINT PK_MESSAGE_OUT7 PRIMARY KEY (MSGOUTSEQNUM)
   )
    IN JUICE.JCETB1
    ;
CREATE UNIQUE INDEX PK_MESSAGE_OUT ON MESSAGE_OUT (MSGOUTSEQNUM)
USING STOGROUP JCEGRP1 ERASE NO DEFINE YES BUFFERPOOL BP1 CLOSE YES DEFER NO COPY NO
;

CREATE TYPE 2 UNIQUE INDEX MSGOUTINDX ON MESSAGE_OUT ( SECID )
USING STOGROUP FFIXDB2 ERASE NO DEFINE YES
BUFFERPOOL BP1 CLOSE YES DEFER NO COPY NO;

-- CREATE LOB TABLESPACE MSGOLOB
-- IN G1I4DELV
-- USING STOGROUP FFIXDB2
-- PRIQTY 3000 SECQTY 3000 LOCKMAX 0 CLOSE NO bufferpool BP8K1
-- LOG NO;

CREATE AUXILIARY TABLE G1I4DELV.AUX_MSGOUT
IN G1I4DELV.MSGOLOB
STORES MESSAGE_OUT
COLUMN XMLMSGOUT;

CREATE TYPE 2 UNIQUE INDEX MSGOAUX ON AUX_MSGOUT
USING STOGROUP FFIXDB2 ERASE NO DEFINE YES
BUFFERPOOL BP1 CLOSE YES COPY NO;


And the relevant snippet from my hibernate mapping:
Code:
<hibernate-mapping package="com.unisys.pdg.common.data">
   <class name="MessageOut" table="MESSAGE_OUT">
      <id
         column="MSGOUTSEQNUM"
         name="messageOutSequenceNumber"
         type="int"
         unsaved-value="0"
      >
         <generator class="native" />
      </id>
      <version
         column="SFTLCK"
         name="softLock"
         type="int"
         unsaved-value="undefined"
       />

      <property
         column="TIM"
         name="timeStamp"
         not-null="true"
         type="java.sql.Timestamp"
       />
      <property
         column="TX_REFPRMSCH"
         name="txRefSchedule"
         not-null="false"
         type="string"
       />
      <property
         column="TX_REF"
         name="txRef"
         not-null="true"
         type="string"
       />
      <property
         column="XMLMSGOUT"
         name="xmlMessageOut"
         not-null="true"
         type="com.unisys.pdg.common.dao.StringToClobMapper"
      >
         <meta attribute="actual-type">java.lang.String</meta>
         <column
            name="XMLMSGOUT"
            sql-type="CLOB"
          />
      </property>
   </class>
</hibernate-mapping>


The type 'com.unisys.pdg.common.dao.StringToClobMapper' is my version of the UserType implementation from the link given atop.

Does this help you anyhow?

cheers,

--Tim
[/u][/list]


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