-->
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: Virtual storage or database resource is not available
PostPosted: Tue Nov 22, 2005 11:07 am 
Beginner
Beginner

Joined: Sun Oct 09, 2005 3:21 pm
Posts: 40
Hibernate version: 3.1.0

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

Getting a SQLException: "Virtual storage or database resource is not available" error while trying to perform batch inserts by reading one record at a time from a MySQL database into a DB2 V8.2 database. Pretty sure I have not used flush()/close() methods properly or using CMT transaction management propertly.

Have 2 CMT (Container Beans, Stateless) defined by the default transaction level to "Required" with one loading a configuration Hibernate file moduled against MySQL and the other EJB against DB2.

Built a third CMT EJB as a data migration controller brokering records one at a time between the MySQL Hibernate EJB and the DB2 EJB. This controller as ejb-ref remote references to the other session beans and the code looks about like:


Code:
/**
* @ejbgen:session ...
*   transaction-type="Container" type="Stateless"
*   ejb-name = "MatrixDataTransport"
*
* @ejbgen:jndi-name
*   remote = "ejb.MatrixDataTransportRemoteHome"
*
* @ejbgen:file-generation ...
*
* @ejbgen:ejb-ref ...
*   home="ReleaseManagerHome"
*   name="ejb/MyReleaseManager"
*   jndi-name="ejb.ReleaseManagerRemoteHome"
*
* @ejbgen:ejb-ref
*   home="MatrixMySQLManagerHome"
*   name="ejb/MyMatrixMySQLManager"
*   jndi-name="ejb.MatrixMySQLManagerRemoteHome"
*/
public class MatrixDataTransportBean
  extends GenericSessionBean
  implements SessionBean
{
  ...

  private ReleaseManager getReleaseManager ()
  {
    try
    {
      javax.naming.Context ic = new InitialContext();
      ReleaseManagerHome rManagerHome = (ReleaseManagerHome)
        ic.lookup("java:comp/env/ejb/MyReleaseManager");

      return rManagerHome.create();
    } catch ....
  }

(same creation code for MyMatrixMySQLManager)

  /**
    * @ejbgen:remote-method
    */
  public int transferRelease(String release) {
    ReleaseManager releaseManager = getReleaseManager();
    MatrixMySQLManager mmManager = getMatrixMySQLManager();
      
    try
    {
      // queries via Hibernate all release
      //in MySQL with a name like :release
      Iterator releaseIterator =
        mmManager.getRelease(release).iterator();
      ...
      // loop through releases
        // 1) create a new Release in DB2
   // 2) update newly created Release in DB2
   //    with extra info
   // 3) if 20 statements then call a remote
   //    EJB method that issues a flush()/clear()
   //    [see batchCommit() method below]
    } catch ...
}



Inside the MyMatrixMySQLManager/ReleaseManager beans all of the methods works about the same way:
Code:
public class ReleaseManagerBean
  extends GenericSessionBean
  implements SessionBean
{
  ...

  /**
    * @ejbgen:remote-method
    */
  public Release createRelease(String name)
  {
    Session aSession = HibernateUtil.getSessionFactory().getCurrentSession();

    Release aRelease = new Release();
    ...
    aSession.save(aRelease);
  }

  ...

  /**
    * @ejbgen:remote-method
   */
  public void batchCommit ()
  {
    Session aSession = HibernateUtil.getSessionFactory().getCurrentSession();

    aSession.flush();
    aSession.clear();
  }
}



And my Hibernate config file for DB2 looks like:
Code:
...
<property name="connection.datasource">matrixDS</property>
<property name="connection.pool_size">1</property>
<property name="dialect">org.hibernate.dialect.DB2Dialect</property>
<property name="show_sql">true</property>
<property name="transaction.factory_class">org.hibernate.transaction.CMTTransactionFactory</property>
<property name="transaction.manager_lookup_class">org.hibernate.transaction.WeblogicTransactionManagerLookup</property>
<property name="hibernate.transaction.flush_before_completion">true</property>
<property name="hibernate.transaction.auto_close_session">true</property>
<property name="hibernate.connection.release_mode">auto</property>
<property name="hibernate.jdbc.batch_size">20</property>
...



Assuming the virtual storage problem is a result of the flush/clear method calls not taking effect?


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.