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)