• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Prepared Statements Closing before execution...

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, I'd be forever grateful to anyone who could point me in the right direction with this problem..
I'm fairly new to websphere so please be patient.

I'm using Websphere V5 running on an i-series.
I've configured a datasource, mapped an alias for context lookups within servlets and server singletons. My Servlets all prep their sql statements in their init methods just fine but when they are executed at a later stage (i.e by some user actions) an exception is thrown saying that "The Statement is Closed". since this is running on a new installation of Websphere and I'm the only one using it, I've been able to up the Statement Cache size to 100, and the minimum pool size to 100 so I don't think my problem is lack of connections. The same code runs fine on JBOSS 3.2 all I've had to change was the datasource context lookup as u may have guessed the application was developed on JBoss and now needs to be moved to Websphere 5.
I'm starting to think I may need a separate connection for each prepared statement and yes I know this is utter madness.

so to finish... help help help please....

By the way the maximum pool size is 300 (its a big machine)..
 
author & internet detective
Posts: 41860
908
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Patrick,
How much before you execute the statement are you getting the connection from the pool? If you are getting the connection in the init method, it is probably stale by the time you execute it.
 
Patrick J McCabe
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Jeanne,
 
Patrick J McCabe
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Jeanne,
pressed enter at this point during the last posting.. so hi again ...

Anyhow, thanks for your reply and you're right the connection is closed/stale but the problem was in my code and not a websphere configuration problem, I realized this when I read through the code again, My singleton which is used by a servlet to provide some reference data on a number of tables, based on an object which holds prepared statements etc...bla bla bla

The problem was that I was setting a previously used resultset to null, why I did this god only knows , This code didn't have the same effect on the connection in JBoss as it did in websphere. Websphere cleans up connections better perhaps? Anyhow changing this solved the problem, I'm still not 100% sure why. Thanks for taking the time to read my posting Jeanne, by the way, best name ever, same as my partners....

Thanks.
Pat.
 
reply
    Bookmark Topic Watch Topic
  • New Topic