• 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
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

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
 
You don't like waffles? Well, do you like this tiny ad?
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic