-->
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: SQL locking on VIEW using UNION over two tables
PostPosted: Mon Feb 07, 2005 10:17 pm 
Newbie

Joined: Mon Feb 07, 2005 10:07 pm
Posts: 2
Hibernate version: 2.1.6

All

I'm also posting this issue on the IBM developerworks db2 forum as I'm unsure where the problem lies :

We're using Hibernate 2.1.6 in a J2EE app on Websphere 5.1 to access numerous DB2/400 files on our IBM iSeries running V5R2 using the JT400 v4.6 toolbox driver.

I'm getting the following error on accessing an SQL view which has a UNION of two files. If other users/applications are accessing one of the physical files included in the UNION statement the following error appears in the trace :
Code:
SQLException: SQLState(57033) vendor code(-913)
java.sql.SQLException: [SQL0913] Row or object JOBS in OSLTAUO3 type *FILE in use.


ie There's a lock on the file.

All access is READ ONLY, ie we're only using SELECT statements. The problem only occours when using the JNDI Datasource set up in hibernate.properties to point to a datasource set up in Websphere. Config is :

Code:
## JNDI Datasource
hibernate.connection.datasource jdbc/myiseries
hibernate.connection.username xxxxx
hibernate.connection.password xxxxx


If the JNDI datasource details are commented out and the URL and driver class for the toolbox driver are setup in hibernate.properties, the error does not occour. Config is :

Code:
## Toolbox driver
hibernate.connection.driver_class com.ibm.as400.access.AS400JDBCDriver
hibernate.connection.url jdbc:as400://myiseries/OSLXXXO3


So, the default behaviour of hibernate using the jt400 driver doesn't produce the error, regardless of record locks in the file, but setting hibernate to use a JNDI reference produces the error.

Any pointers appreciated.

Regards

Niall

Code:
mapping doc :
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
   "-//Hibernate/Hibernate Mapping DTD 2.0//EN"
   "http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
<hibernate-mapping
   package="com.ricoh.trackwise.bizobj">

   <class name="ServiceTO" table="JOBS">
      <id name="id" column="JOBN55">
         <column name="JOBN55"/>
         <generator class="native"/>
      </id>
      
      <property name="account" column="ACNO55"/>
      <property name="jobNumber" insert="false" update="false" column="JOBN55"/>
      <property name="dateOfContact" column="DTCT55" type="com.ricoh.common.utility.CymdDate"/>
      <property name="model" insert="false" update="false" column="INNO55"/>
      <property name="modelCategory" insert="false" update="false" column="MCAT55"/>
      <property name="serialNumber" insert="false" update="false" column="INTY55"/>
      <set name="meterReadings">
         <key column="JOBN11"/>
         <one-to-many class="com.ricoh.trackwise.bizobj.MeterReadingTO"/>
      </set>
      <many-to-one name="asset" class="AssetTO">
         <column name="INNO55"/>
         <column name="INTY55"/>
      </many-to-one>
      <property name="faultCode" insert="false" update="false" column="FLTC55"/>
      <property name="faultDesc1" insert="false" update="false" column="FLT155"/>
      <property name="faultDesc2" insert="false" update="false" column="FLT255"/>
      <property name="status" insert="false" update="false" column="JLST55"/>
      <property name="outstanding" insert="false" update="false" column="OUTS55"/>
      <property name="cono" insert="false" update="false" column="CONO55"/>
      <property name="state" insert="false" update="false" column="STAT55"/>
      <property name="region" insert="false" update="false" column="REGN55"/>
   </class>
   
   
   
</hibernate-mapping>



The full error is :
Code:
SQLException: SQLState(57033) vendor code(-913)
java.sql.SQLException: [SQL0913] Row or object JOBS in OSLTAUO3 type *FILE in use. Cause . . . . . :   The requested object JOBS in OSLTAUO3 type *FILE is either in use by another application process or a row in the object is in use by either another application process or another cursor in this application process. Recovery  . . . :   Look at the previously listed messages in the job log (DSPJOBLOG command) or from interactive SQL press F10 (Display messages in job log) on this display to determine if this is an object or record lock wait time out. Do one of the following: -- If the object is locked by another application process, try the Structured Query Language (SQL) statement again when the object is not in use. Use the Work with Object Locks (WRKOBJLCK) command to determine who is currently using the object. -- If the object is a library and an attempt was made to create a table, view, or index into this library under commitment control, a save-while-active operation may be in progress on the same library by another job in the system. Try the request again when the save-while-active processing is complete. -- If a record is locked by another application process, try the SQL statement again when the record is not in use.  The Display Record Locks (DSPRCDLCK) command will determine who is currently using the record.  -- If this is a record lock held by another cursor in the same application process, you must issue a COMMIT, ROLLBACK, or another FETCH statement on the cursor that is holding the lock before issuing this SQL statement. If this error occurs frequently, use the Change Physical File (CHGPF), Change Logical File (CHGLF), or Override Data Base File (OVRDBF) command to change the object or record wait time out.
   at com.ibm.as400.access.JDError.throwSQLException(JDError.java:520)
   at com.ibm.as400.access.AS400JDBCStatement.commonExecute(AS400JDBCStatement.java:822)
   at com.ibm.as400.access.AS400JDBCPreparedStatement.executeQuery(AS400JDBCPreparedStatement.java:1098)
   at com.ibm.ws.rsadapter.jdbc.WSJdbcPreparedStatement.executeQuery(WSJdbcPreparedStatement.java:426)
   at net.sf.hibernate.impl.BatcherImpl.getResultSet(BatcherImpl.java:87)
   at net.sf.hibernate.loader.Loader.getResultSet(Loader.java:875)
   at net.sf.hibernate.hql.QueryTranslator.iterate(QueryTranslator.java:868)
   at net.sf.hibernate.impl.SessionImpl.iterate(SessionImpl.java:1609)
   at net.sf.hibernate.impl.SessionImpl.iterate(SessionImpl.java:1582)
   at net.sf.hibernate.impl.SessionImpl.iterate(SessionImpl.java:1574)


Top
 Profile  
 
 Post subject:
PostPosted: Thu Apr 27, 2006 3:11 am 
Newbie

Joined: Mon Nov 14, 2005 6:40 am
Posts: 4
Location: Duesseldorf/Germany
Hi flamesnm,

I get the same error when trying to access a view that unions two tables.
Could you solve the problem in the meantime?

Many thanks in advance,

Kodicic


Top
 Profile  
 
 Post subject: Isolation levels
PostPosted: Fri May 05, 2006 9:37 pm 
Newbie

Joined: Mon Feb 07, 2005 10:07 pm
Posts: 2
Hi kodicic

It's a long while ago, but I'm pretty sure the answer was in the isolation levels set on the jdbc resource. I can't remember the exact change I made though.

Hope that helps.


Top
 Profile  
 
 Post subject: Re: SQL locking on VIEW using UNION over two tables
PostPosted: Fri Aug 06, 2010 1:41 am 
Newbie

Joined: Fri Aug 06, 2010 1:31 am
Posts: 1
Hi

I'm having the same problem. Did anyone manage to solve this yet?

Thanks


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.