aimueller
asked on
displayed session number in tomcat web application manager..question
Hi,
If I start my servlet I see a new session in the tomcat web application manager. But After logging out and calling session.invalidate() the number of created session is still the same???
please ..help!!!
If I start my servlet I see a new session in the tomcat web application manager. But After logging out and calling session.invalidate() the number of created session is still the same???
please ..help!!!
the session still will exist... it will just be empty, and will be destroyed when it times out (or tomcat decides it is dead)
ASKER
actually I have a problem with db connection pool: My servlet lost the db connection after 1 or 2 minutes, the configuration file is:
<Resource name="jdbc/test" scope="Shareable" type="javax.sql.DataSource "/>
<ResourceParams name="jdbc/test">
<parameter>
<name>driverClassName</nam e>
<value>oracle.jdbc.driver. OracleDriv er</value>
</parameter>
<parameter>
<name>url</name>
<value>jdbc:oracle:thin:@1 .1.1.0:152 1:test</va lue>
</parameter>
<parameter>
<name>username</name>
<value>test</value>
</parameter>
<parameter>
<name>password</name>
<value>test</value>
</parameter>
<parameter>
<name>maxActive</name>
<value>4</value>
</parameter>
<parameter>
<name>maxWait</name>
<value>10000</value>
</parameter>
<parameter>
<name>maxIdle</name>
<value>40</value>
</parameter>
</ResourceParams>
what is wrong in the config file..please!!
<Resource name="jdbc/test" scope="Shareable" type="javax.sql.DataSource
<ResourceParams name="jdbc/test">
<parameter>
<name>driverClassName</nam
<value>oracle.jdbc.driver.
</parameter>
<parameter>
<name>url</name>
<value>jdbc:oracle:thin:@1
</parameter>
<parameter>
<name>username</name>
<value>test</value>
</parameter>
<parameter>
<name>password</name>
<value>test</value>
</parameter>
<parameter>
<name>maxActive</name>
<value>4</value>
</parameter>
<parameter>
<name>maxWait</name>
<value>10000</value>
</parameter>
<parameter>
<name>maxIdle</name>
<value>40</value>
</parameter>
</ResourceParams>
what is wrong in the config file..please!!
> My servlet lost the db connection after 1 or 2 minutes,
You keep the connection open all that time?
You should open it when you need it, then close it again to return it to the pool
You keep the connection open all that time?
You should open it when you need it, then close it again to return it to the pool
ASKER
in my code:
- the main servlet resolves the datasource in the init()
- the main servlet opens - every access - the db connection in the doPost() and gives it to the beans
- finally the main servlet do close the db connection
the beans do some calculations that takes max. 1 min.
May be the config file that I post it is not trivial??
- the main servlet resolves the datasource in the init()
- the main servlet opens - every access - the db connection in the doPost() and gives it to the beans
- finally the main servlet do close the db connection
the beans do some calculations that takes max. 1 min.
May be the config file that I post it is not trivial??
Remember that connections are not managed by the run-time as your objects (garbage-collection). An open connection should be closed :-)
>> finally the main servlet do close the db connection
What if there are exceptions in between? Is the connection closed in a try block or a finally block (it should be in the finally block).
>> finally the main servlet do close the db connection
What if there are exceptions in between? Is the connection closed in a try block or a finally block (it should be in the finally block).
ASKER
yeh.. the main servlet do close the connection in the finally block.
since every bean need a db connection, the db connection should be open in the main servlet :-(
since every bean need a db connection, the db connection should be open in the main servlet :-(
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.