oops, we are cross posting, no good, sorry about that.

> I'm re-writing the PreparedStatement cache
> -  so that it is configurable from jboss.jcml.  I can no way right now
> other than changing the source directly of configuring the PS cache size.
> - so that connections watch all open cursors that are created(Statements
> and PreparedStatements).  Basically if you have 50 PreparedStatements
> cached, your max open cursors  is 50, and you want to createStatement,
> I'm making the connection release one of the cached PreparedStatement so
> that the new createStatement won't fail.

remember that during a transaction, the connection (JDBC 1) used gets
associated with the transaction context.
hence, other transactions/threads will not be accessing the connection
during that time since they are not involved in this DB transaction.

why would you want to keep the cursors open. once you retrieved your
resultset, your are done with the cursor and should close it. the prepared
statement is nothing but precompiled (during runtime) SQL, and if the
connection should keep this precompiled statement alive on the database, not
through the PreparedStatement reference that the programmer holds in his
code.

can somebody please tell *ME* to shut up, if I am completely off balance
here :)

Filip

~
Namaste - I bow to the divine in you
~
Filip Hanik
Software Architect
[EMAIL PROTECTED]
www.filip.net

> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED]]On Behalf Of Bill
> Burke
> Sent: Thursday, March 22, 2001 2:57 PM
> To: [EMAIL PROTECTED]
> Cc: [EMAIL PROTECTED]
> Subject: [JBoss-dev] Re: [JBoss-user] A little BMP
> philosophy/understanding
>
>
> In JBoss 2.1 (minerva beta3?) the PreparedStatement cache does have a
> limit. Also, when the cache reaches it's limit, it removes the least
> recently used PS and closes it.
>

> - Is it useful to block if the max open cursors have been reached when
> creating a new Statement or PreparedStatement?  This would only be
> useful if more the one thread had access to the connection, but does
> that ever happen, and is it allowed to happen?
>
> Bill
>
> Mike Jau wrote:
>
> > So, the caching of the PreparedStatement is stored in the database
> > connection context and is not shared between the database connection.
> > I am thinking a work around way and it may solve the caching
> > issue.  If we have the "named connection" from the pool with the
> > lifecyclye control to release the PreparedStatement from the
> > applicaiton which invoke the container specific API, it probably can
> > solve the problem.
> >
> >
> >
> > - Mike Jau
> >
> >     -----Original Message-----
> >     From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
> >     Sent: Thursday, March 22, 2001 1:25 PM
> >     To: [EMAIL PROTECTED]
> >     Subject: RE: [JBoss-user] A little BMP philosophy/understanding
> >
> >
> >     In the original JBoss 2.0 version the PreparedStatement cache was
> >     not discarded after the connection was returned to the pool
> >     because more than likely you might want to issue that one of these
> >     PreparedStatements again. To make matters worse there wasn't an
> >     upper limit on the number of PreparedStatement objects in the
> >     cache so things would continue to grow as you prepared new SQL
> >     statements. If you happened to prepare the same exact SQL
> >     statement then you received the previously cached
> >     PreparedStatement object but otherwise you got a new
> >     PreparedStatement that was also added to the cache. This would
> >     continue until either a) the database complained or b) you ran out
> >     of memory which ever came first. On Oracle, for example, each
> >     PreparedStatement takes memory on the database and once you hit
> >     100 or so the database throws an exception when you try to get
> >     another one.
> >
> >     I patched the code by releasing the PreparedStatement cache when
> >     the Connection was released and submitted that fix but I'm not
> >     sure it was accepted. What really needs to happen is that the
> >     PreparedStatement cache needs to be enhanced so that an upper
> >     bound can be established via a configuration variable so that
> >     after x PreparedStatements have been cached new PreparedStatements
> >     will push one of the old ones out of the cache.
> >
> >     - Jon Harvie
> >
> >
> >
> >
> >     Mike Jau <[EMAIL PROTECTED]>
> >     Sent by: [EMAIL PROTECTED]
> >
> >     03/22/2001 12:42 PM
> >     Please respond to jboss-user
> >
> >
> >             To:        "'[EMAIL PROTECTED]'"
> >     <[EMAIL PROTECTED]>
> >             cc:
> >             Subject:        RE: [JBoss-user] A little BMP
> >     philosophy/understanding
> >
> >
> >
> >
> >     Could you give me some background information about the
> >     Preparedstaement
> >     caching on the EJB container side?
> >
> >     Since the connection get from pool need to return to pool once the
> >     transaction done. I assumed that the resouce associate to this
> >     connection
> >     should be released and the released resoure include the
> >     preparedstatement.
> >     Later on, the create preparedstatement will be invoked again from
> >     different
> >     connection. How the preparedstatement cached is my question?
> >
> >
> >     - Mike
> >
> >     -----Original Message-----
> >     From: Bill Burke [mailto:[EMAIL PROTECTED]]
> >     Sent: Thursday, March 22, 2001 12:10 PM
> >     To: [EMAIL PROTECTED]
> >     Subject: Re: [JBoss-user] A little BMP philosophy/understanding
> >
> >
> >
> >
> >     Dan Christopherson wrote:
> >
> >      > On Fri, 23 Mar 2001, Peter Routtier-Wone wrote:
> >      >
> >      >>> Someone from this discussion group indicate that container
> >     might cache
> >     the
> >      >>> PreparedStatement.
> >      >>
> >      >> I can't speak with authority on this, but that rings true. I'm
> >     guessing
> >     that
> >      >> interception doesn't happen for the setEntityContext()
> method and
> >     therefore
> >      >> you actually create a PreparedStatement rather than receiving
> >     one from
> >     the
> >      >> pool.
> >      >>
> >      >>> Just for kicks, I gave it a try but transactions weren't
> >     completed and
> >      >>> they'd just hang out there forever, blocking every other
> >     persistence and
> >      >>> finder method until they timed out.
> >      >>
> >      >> That would bollox lifecycle management, and the described
> >     behaviour
> >     wouldn't
> >      >> be at all surprising.
> >      >
> >      > This is also a common bean bug: 'close()' should be
> called on every
> >      > resultset, statement, and connection in a finally clause so
> >     that you know
> >      > it happens every time.
> >      >
> >      >> On the other hand, I'd have thought that PreparedStatements
> >     would be far
> >      >> less costly to manufacture than Connections, and therefore not
> >     worth the
> >      >> overhead of managing a pool. I think I'll poke my nose into
> >     the source
> >     and
> >      >> see what's there.
> >      >
> >      > There's often communication with the database to create the
> >      > PreparedStatement. That way it can pre-compile a query plan.
> >     There is a
> >      > prepared statement cache in JBoss: in JBoss 2.0, it caused
> >     problems with
> >      > Oracle's cursor limit (fixed in 2.1).
> >
> >
> >     I'm re-writing the minerva PreparedStatement caching so it handles
> >     cursor limit better.  I'll submit the code tomorrow after I test it.
> >
> >     Bill
> >
> >
> >
> >     _______________________________________________
> >     JBoss-user mailing list
> >     [EMAIL PROTECTED]
> >     http://lists.sourceforge.net/lists/listinfo/jboss-user
> >
> >     _______________________________________________
> >     JBoss-user mailing list
> >     [EMAIL PROTECTED]
> >     http://lists.sourceforge.net/lists/listinfo/jboss-user
> >
> >
>
>
>
> _______________________________________________
> Jboss-development mailing list
> [EMAIL PROTECTED]
> http://lists.sourceforge.net/lists/listinfo/jboss-development
>


_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to