You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Matt Raible <ma...@yahoo.com> on 2002/06/12 17:20:01 UTC

Re: Problem with maintaining a database connection in a session bean

Connections are not serializable (to my knowledge) and may through a
NotSerializableException when you put the information into the session.  This
might be closing your connection.

--- Ted Husted <hu...@apache.org> wrote:
> A better place to post a message like this is the USER list where there
> are more people to help you. 
> 
> Though, this strategy is not directly related to Struts. You might want
> to check other resources, like JSP-Interest and JGuru. 
> 
> http://archives.java.sun.com/jsp-interest.html
> 
> http://www.jguru.com/faq/home.jsp?topic=JSP
> 
> -- Ted Husted, Husted dot Com, Fairport NY US
> -- Developing Java Web Applications with Struts
> -- Tel: +1 585 737-3463
> -- Web: http://husted.com/about/services
> 
> 
> Georges wrote:
> > 
> > Hi,
> > 
> > I'm trying to build a small pilot application with Struts.
> > My ultimate goal is a dynamic web application with
> > intensive use of database.
> > My database is Oracle 8.
> > The problem is following:
> > in 'LoginAction' I set up a database connection
> > (java.sql.Connection variable) with Oracle
> > database. I "save" it
> > in the User session bean as a bean-variable.
> > Then I test it in a jsp-page.
> > Everything seems to work: the variable containing
> > the database connection is created and put into
> > User bean (something like ...setConnection(connection)).
> > The first time the jsp-page works well: the connection
> > comes from "conn=user.get_connection()", I can send
> > a select-query to the database and display the
> > outcome etc.
> > But if I refresh the jsp-page, then at a certain
> > moment an error message is displayed:
> > java.sql.SQLException: Closed Connection
> > 
> > I undestand that the connection gets somehow
> > lost in the session bean. This happens especially
> > when I test with two parallel sessions
> > (one from IE and another from Netscape).
> > 
> > Can anyone help me? Where could the connection go lost?
> > 
> > Thanks,
> > George.
> > 
> > P.S
> > I have to save a connection with every session
> > because this way I can get user info from
> > the database and administer database privileges.
> > I can't use just a connection pool and
> > get a connection from there every time I need
> > something from the database.
> > I have to lock records, maintain transactions etc.,
> > so every user/session needs to have an
> > individual database connection.
> > 
> > -----------------------------------------
> > Teatri- , kino- ja kontserdipiletid n��d hiirekliki kaugusel!
> > http://www.hot.ee
> > 
> >   ------------------------------------------------------------------------
> > --
> > To unsubscribe, e-mail:  
> <ma...@jakarta.apache.org>
> > For additional commands, e-mail:
> <ma...@jakarta.apache.org>
> 
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
> 


__________________________________________________
Do You Yahoo!?
Yahoo! - Official partner of 2002 FIFA World Cup
http://fifaworldcup.yahoo.com

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>