Hi friend!
I was also having the same problem. After that I
removed the connection statements in the init()
method. I created connections only in doPost method.
It works fine. There is some problem or we have to
follow some rules if we are using connection
statements in the init() method. If any body knows,
please inform us.
Thanks in advance.
Poornima Visvesvaran.
--- Mittal Shwetabh <[EMAIL PROTECTED]> wrote:
> Thanks Geeta,
>
> Actually I am not destroying the connection created
> in Init() method (that is
> the last job)
> I am destroying only the connection I made in
> doPost().
>
> The flow of application is as follows:
>
> 1. It creates a coonection in the init() method and
> using this connection
> displays login screen.
>
> 2. Now to test whether the login user is
> authorised(can connect to data base
> or not)
> or not I again make a connection in doPost()
> using the login user as
> user-id.
> 3. set a flag which will show whether this
> connection was successful or not.
> 4. Close this connection(not the one got using
> init() method).
> (In a sense I am making this connection just to
> check whether this user is
> authorised
> user or not in that environment)
>
> 5. if flag says the previous connection was
> successful then do the further
> processing
> using the connection made by init() method and
> the first task is to display
> a
> hyper link... which sometimes appears and some
> times not(the problem)....
> 6. If I restart the OAS, it works fine. So whenever
> that exception is thrown,
> just
> restart the server and no probs, which is totally
> unpractical.
>
> I hope now u all will be able to get my problem.
> Please revert back....
>
> Regards,
> Shwetabh
>
>
>
> Mittal:
>
> I am not really clear on what you are trying to do,
> but I think the problem
> may be
> because you are creating the connection in the
> init() method but destroying it
> in
> perhaps a doPost. You may then be trying to access
> the destroyed connection
> again
> in a subsequent doPost, which will not work. This is
> because code in the init()
> method is executed just once at initialization time
> (and not every time a user
> accesses the servlet via a doPost or doGet.) You may
> therefore want to get the
> connection each time in the doPost by creating a
> connection pool in your init(0
> method instead. Recent posts to this forum have
> recommended this link for more
> information on connection pooling:
>
http://www.webdevelopersjournal.com/columns/connection_pool.html
>
> Geeta
>
> Mittal Shwetabh wrote:
>
> > Dear All,
> >
> > Can anybody please let me know the reason behind
> gettng this exception:
> >
> > java.sql.SQLException: Io exception: A connection
> with a remote socket was
> > reset
> > by that socket.
> >
> > Basically in my application(Java Servlets) I
> already have a connection
> object
> > (got during initialization)
> > and in between I again need to connect to
> database and then destroy this
> > connection with some
> > other user-id (who will log on through a login
> screen)to check that user
> > validity.
> > And then provide hyper link to application using
> my existing connection(got
> > during initialization), if the
> > user is authorised for it.
> >
> > The problem is that sometimes this link does not
> appear and the above
> > exception is thrown...
> > and sometimes it works fine...
> >
> > Environment:
> > OAS8.0.4
> > AIX4.1.2
> > Oracle8.1.6
> > jdbc driver
> >
> > Waiting for your reply.
> >
> > Regards
> > Shwetabh Mittal
>
>
___________________________________________________________________________
> To unsubscribe, send email to [EMAIL PROTECTED]
> and include in the body
> of the message "signoff SERVLET-INTEREST".
>
> Archives:
>
http://archives.java.sun.com/archives/servlet-interest.html
> Resources:
>
http://java.sun.com/products/servlet/external-resources.html
> LISTSERV Help:
http://www.lsoft.com/manuals/user/user.html
__________________________________________________
Get personalized email addresses from Yahoo! Mail - only $35
a year! http://personal.mail.yahoo.com/
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html