Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8971779
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T18:02:45+00:00 2026-06-15T18:02:45+00:00

My ASP.NET C# application is connection to an Oracle database, running a stored procedure,

  • 0

My ASP.NET C# application is connection to an Oracle database, running a stored procedure, and returning a reader with the command behavior of CloseConnection. The reader itself is disposed but – the Oracle sessions persist as inactive in V$SESSION. In a few hours, this turns into an error when another customer uses the application and we receive the error ‘ORA-02399: exceeded maximum connect time, you are being logged off’. Further attempts to connect to Oracle return ‘ORA-01012: not logged on’

Here is the connection string:

User Id=UserID;Password=userPass;Data Source=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)  (HOST=IP.IP.IP.IP)(PORT=XXXX))(CONNECT_DATA=(SID=SID)));;Max Pool Size=5;Connection Timeout=60;Connection Lifetime=120;

Here is how the reader is used:

using (OracleDataReader dr = OraFunctions.ExecuteReader(input.ConnectionString,
                                                                    CommandType.Text,
                                                                    input.SqlStmt,
                                                                    null))
{
 while (dr.Read())
 {
 //do stuff here 
 }
 dr.Dispose();
}

Here is the class that connects to Oracle:

public static OracleDataReader ExecuteReader(string connectionString, CommandType commandType, string commandText, OracleParameter[] commandParameters) {
        OracleConnection connection = null;
        OracleCommand command = new OracleCommand();
        try {
            connection = new OracleConnection(connectionString);
            connection.Open();
            command.Connection = connection;
            command.CommandType = commandType;
            command.CommandText = commandText;

            if (commandParameters != null) {
                foreach (OracleParameter param in commandParameters) {
                    command.Parameters.Add(param);
                }
            }
            //Passing CommandBehavior.CloseConnection flag to the ExecuteReader method makes the DataReader connection to be closed when the DataReader is closed. 
            OracleDataReader reader = command.ExecuteReader(CommandBehavior.CloseConnection);
            command.Dispose();
            return reader;
        } catch {
            if (connection != null) {
                command.Dispose();
                connection.Close();                    
            }
            throw;
        }
    }

I’m looking for any hints on why the connections aren’t actually closing. I’m using Oracle.DataAccess.Client. My guess is that the datareader’s command behavior isn’t working and that I need to recode this as a dataset where I can explitictly close the connection without having to rely on the CommandBehavior.

Thoughts? Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T18:02:46+00:00Added an answer on June 15, 2026 at 6:02 pm

    We never could get this worked out. We ended up disabling connection pooling and the open/inactive sessions went away in Oracle. If anyone reads this and has a suggestion on what was going wrong, I would definitely appreciate your input.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm developing an ASP.NET application with VB, and using SQL Command and Connection in
I want create a ASP.NET Application (aspx site) that connection with a database and
My asp.net application is not using formsauthentication. Instead we make a call to database,
I have an asp.net application and I need to have two sessions running at
We have an ASP.NET application running on .NET 3.5 and are running into a
how can I enable database logging in my ASP.net application? I am using VS2010
I'm using an Oracle database(10g) which contains a stored procedure called Foo. Foo takes
Consider an ASP.NET application with has a connection pool memory leak problem (where connections
We have an ASP.NET application running at a customer site that uses ActiveDirectory for
I am developing an ASP.net application with Access database. I need to convert this

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.