• 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

ORA-02391: exceeded simultaneous SESSIONS_PER_USER limit

 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In my jdbc application I am getting above error, Can you please tell me what is the main reason behind it.

private static void initializeConnection() {
try {
EnvironmentProperties envProperties = DatabaseProperties.envProperties;

String str = envProperties.getDbdriver() + " "
+ envProperties.getDburl() + envProperties.getUserName()
+ envProperties.getPassword();

logger.info(str);

Class.forName(envProperties.getDbdriver());
DBManager.connection = DriverManager.getConnection(
envProperties.getDburl(), envProperties.getUserName(),
envProperties.getPassword());

logger.info("CREATED THE SUCCESSFUL DB CONNECTION!");
} catch (ClassNotFoundException classE) {
logger.error(classE);
// classE.printStackTrace();
} catch (SQLException sqlE) {
logger.error(sqlE);
// sqlE.printStackTrace();
} catch (Exception e) {
logger.error(e);
// e.printStackTrace();
}
}
 
Sheriff
Posts: 3837
66
Netbeans IDE Oracle Firefox Browser
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Oracle's error's are usually easily searchable: ORA-02391.

The underlying cause probably is that your application has created too many connections. Your initConnection function creates a new connection, does nothing with it and does not close it (do you call it repeatedly?). Always close connections properly in the finally section.



 
Kuyni Kumar
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
public class DatabaseFactory implements DataBaseFactoryInterface {

/*
* Create the Database Connection
*
* @see com.cisco.dbts.model.base.DataBaseFactoryInterface#getDBConnection()
*/
public Connection getDBConnection() throws SQLException {

DatabaseProperties.loadProperties();
return DBManager.getConnection();
}

/*
* Close the Database connection if open
*
* @see
* com.cisco.dbts.model.base.DataBaseFactoryInterface#closeDBConnection(
* java.sql.Connection)
*/
public void closeDBConnection(Connection connection) {
if (connection == null) {
return;
}
try {
//System.out.println(connection);
connection.close();
} catch (SQLException e) {
e.printStackTrace();
}
}

}

The above is my class - which is having closeDBConnection and getDBConnection methods.
But my question is , even I close all the connections. Still it is in idle state from the oracle side.
also. If I close connection my client side will it also close the connection on oracle side.
If not how to acheive that. Is connection pool will help in that?
 
Kuyni Kumar
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I got the solution. There is nothing wrong from the code.
This usually happens when you have limited number of connections available from Database. The number of connection will be maintained by the Database Admin.
At enterprise level, It is not possible to provide unlimited connection to the every team on the same database. Hence when we reach that limit it will through the above mentioned error.
Hence the solution for this problem is to have a good connection pool mechanism else have a connection pool datasource in your application server.

Thanks
Rajesh
 
We've gotta get close enough to that helmet to pull the choke on it's engine and flood his mind! Or, we could just read this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic