inactive session in oracle by jdbc

inactive session in oracle by jdbc  using -'oracle,jdbc'

We have a web service written in Java and is connecting to Oracle database for data extraction. Recently, we encountered too many inactive session in Oracle database from JDBC which is our web service.

We are very sure that all the connection is being closed and set to null after every process.

Can anyone help us in this? Why is it causing inactive session in the database and what can be the solution to this.

Thank you.

asked Oct 7, 2015 by ajit.chavhan
0 votes

1 Answer

0 votes

What, exactly, is the problem?

Normally, the middle tier application server creates a connection pool. When your code requests a connection, it gets an already open connection from the pool rather than going through the overhead of spawning a new connection to the database. When your code closes a connection, the connection is returned to the pool rather than going through the overhead of physically closing the connection. That means that there will be a reasonable number of connections to the database where the STATUS in V$SESSION is "INACTIVE" at any given point in time. That's perfectly normal.

Even under load, most database connections from a middle tier are "INACTIVE" most of the time. A status of "INACTIVE" merely means that at the instant you ran the query, the session was not executing a SQL statement. Most connections will spend most of their time either sitting in the connection pool waiting for a Java session to open them or waiting on the Java session to do something with the data or waiting on the network to transfer data between the machines.

Are you actually getting an error (i.e. ORA-00020: maximum number of processes exceeded)? Or are you just confused by the number of entries in V$SESSION?

answered Oct 7, 2015 by sachin wagh