Entity bean - Connection busy ?

Discussions

EJB design: Entity bean - Connection busy ?

  1. Entity bean - Connection busy ? (5 messages)

    Hi friends,

    Plz help me understand..

    I am trying out an entity bean example with CMP. I use SQL server database with a JDBC-ODBC Bridge driver.
    The first time i try to insert a row and execute some finder methods based on the row inserted and the programe
    works fine..and then i try to run the same program again and, as expected, it throws a Duplicate key exception..
    understandable. But after this, i delete that row from the table, and then i execute the same program and i get
    the exception "java.sql.SQLException: [Microsoft][ODBC SQL Server Driver]Connection is busy with results for another hstmt".(Complete stack trace attached) I just can not understand what is happening. But when i restart the server, everything is fine ie - the program inserts the row, executes finders & returns the results.

    Thanks & Regards
    Alagapan

    java.rmi.RemoteException: EJB Exception:; nested exception is:
    java.sql.SQLException: [Microsoft][ODBC SQL Server Driver]Connection is busy with results for another hstmt

    Start server side stack trace:
    java.sql.SQLException: [Microsoft][ODBC SQL Server Driver]Connection is busy with results for another hstmt
            at sun.jdbc.odbc.JdbcOdbc.createSQLException(JdbcOdbc.java:6031)
    at sun.jdbc.odbc.JdbcOdbc.standardError(JdbcOdbc.java:6188)
            at sun.jdbc.odbc.JdbcOdbc.SQLExecute(JdbcOdbc.java:2533)
            at sun.jdbc.odbc.JdbcOdbcPreparedStatement.execute(JdbcOdbcPreparedStatement.java:217)
            at sun.jdbc.odbc.JdbcOdbcPreparedStatement.executeUpdate(JdbcOdbcPreparedStatement.java:139)
            at weblogic.jdbc.pool.Statement.executeUpdate(Statement.java:293)
            at weblogic.jdbc.rmi.internal.PreparedStatementImpl.executeUpdate(PreparedStatementImpl.java:64)
            at weblogic.jdbc.rmi.SerialPreparedStatement.executeUpdate(SerialPreparedStatement.java:58)
            at Product_meu6z3__WebLogic_CMP_RDBMS.__WL_create(Product_meu6z3__WebLogic_CMP_RDBMS.java:1041)
            at Product_meu6z3__WebLogic_CMP_RDBMS.ejbPostCreate(Product_meu6z3__WebLogic_CMP_RDBMS.java:971)
            at java.lang.reflect.Method.invoke(Native Method)
            at weblogic.ejb20.manager.DBManager.create(DBManager.java:583)
            at weblogic.ejb20.manager.DBManager.remoteCreate(DBManager.java:462)
            at weblogic.ejb20.internal.EntityEJBHome.create(EntityEJBHome.java:190)
            at ProductEJB_meu6z3_HomeImpl.create(ProductEJB_meu6z3_HomeImpl.java:77)

            at ProductEJB_meu6z3_HomeImpl_WLSkel.invoke(Unknown Source)
            at weblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:296)
            at weblogic.rmi.cluster.ReplicaAwareServerRef.invoke(ReplicaAwareServerRef.java:93)
            at weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.java:265)
            at weblogic.rmi.internal.BasicExecuteRequest.execute(BasicExecuteRequest.java:22)
            at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
            at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
    End server side stack trace

    Threaded Messages (5)

  2. Entity bean - Connection busy ?[ Go to top ]

    Duplicate key is because you have not implemented Primark Key class properly. Make you beans unique in pool so that app server can figure out and it won`t throw Duplicate key exception.

    Can specify which app server are you using ??
  3. Entity bean - Connection busy ?[ Go to top ]

    Hi friends,

    >
    ----------------------
    > The first time i try to insert a row and execute some finder methods based on the row inserted and the programe
    > works fine..and then i try to run the same program again and, as expected, it
    throws a Duplicate key exception..
    ----------------------
    a. check that primary key class is oproperly defined.
    b. If u have defined it properly then, check whether u have some hard coded values for promary key beacuse of which u r getting this exception.

    ----------------------
    > the exception "java.sql.SQLException: [Microsoft][ODBC SQL Server Driver]Connection is busy with results for another hstmt".(Complete stack trace attached) I just can not understand what is happening. But when i restart the server, everything is fine ie - the program inserts the row, executes finders & returns the results.
    ----------------------
    U r using weblogic,
    a) please check whether u r closing all the connection properly.
    b) Look for connection pool properites and increase the Maximum Capacity of connection pool. and the value Capacity Increment is 1 or more.
    If u don't know where to look for this properties. Tell me which weblogic version u r using. may be then, i can tell u where to look for them.
  4. Entity bean - Connection busy ?[ Go to top ]

    Hi ,

    Thank you very much for ur inputs.

    1. I get the DuplicatePrimaryKey exception becoz i use hard coded inputs and the exception is expected..but not when i run the same code, after i delete the previously inserted rows.

    2. The 'Connection busy' is the problem i face. And becoz i'm using CMP my code does NOT have any connections/statements/resultsets..etc. And the connection pool inital size is set to 2 and capacity increment to 2 and max capacity to 10. I use weblogic 6.1.

    I had some other inputs which says that itz becoz of SQL server - Bridge driver limitation of 1 statement for 1 connection. I'm yet to try out using another driver. Plz let me know if have anything to say.

    Thanx & Regards
    Alags
  5. Entity bean - Connection busy ?[ Go to top ]

    I had some other inputs which says that itz becoz of SQL server - Bridge driver limitation of 1 statement for 1 connection. I'm yet to try out using another driver. Plz let me know if have anything to say.


    ur connection properties are OK, so, there could be some driver limitation. We had such problem when we were not able to make more than 5 connection, but that was with oracle and that had nothing to do with the driver. I have never worked on SQL server so, I cannot help u on that matter.

    In-fact, in order to check whether ur driver has any limitation, u can check in weblogic admin console for the no of connections in connection pool. if they are 2 as u have specified. then ur driver allows to create atleast two connection. try increasing the initial of pool size and u will know whether there are any limitation associated with ur driver.
  6. Entity bean - Connection busy ?[ Go to top ]

    This problem occures while using SQL server. Do not create statements unnecessarliy or close previous unused statements and connection. Hoping this might work.

    Try Daffodil DB