wood burning stoves 2.0
The moose likes EJB and other Java EE Technologies and the fly likes Entity bean - Connection busy ?! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Entity bean - Connection busy ?!" Watch "Entity bean - Connection busy ?!" New topic

Entity bean - Connection busy ?!

JAlagapan Thiagarajan

Joined: Feb 21, 2003
Posts: 2
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 program 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
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
Chris Mathews
Ranch Hand

Joined: Jul 18, 2001
Posts: 2712
Apparently this is caused by a well-known SQL Server ODBC Driver limitation such that only one active Statement is allowed on a single Connection. AFAIK, there is no known work around for this limitation except to ensure all Statements and ResultSets are properly closed. Unfortunately, this is out of your control since you are using CMP.
My recommendation is to abandon the JDBC-ODBC Bridge Driver and use a straight SQL Server 2000 JDBC Driver. Microsoft offers a free type 4 JDBC driver for SQL Server 2000 on their website.
JAlagapan Thiagarajan

Joined: Feb 21, 2003
Posts: 2
Thank you very much Chris.
Dana Hanna
Ranch Hand

Joined: Feb 28, 2003
Posts: 227
If it's worth my 2 cents - I agree. The JDBC-ODBC driver is not wirth a production app. Just look at what it does with an empty resultset returned from a SQL statement!!!
I agree. Here's the link: http://aspose.com/file-tools
subject: Entity bean - Connection busy ?!
It's not a secret anymore!