Why handle count keeps increasing with active database connection?

Hi,
I have an application in which windows handle count keeps increasing..I did not find any reason why this is happening? could you please help me out? below is the code:
I have also tried to close the database connection but not work.
using System;
using System.IO;
using System.Data.Common;
using System.Windows.Forms;
using System.Threading;
using System.Configuration;
using System.Data;
using System.Data.SqlClient;
namespace SampleAppWithDbConnection
    class Program
        private static SqlConnection _oCon = null;
        public static SqlConnection oCon
            get
                if (_oCon == null)
                    _oCon = new SqlConnection();
                return _oCon;
            set
                _oCon = value;
        public static int gIntervalo = 1000;
        [STAThread]
        public static void Main(string[] args)
            var gStrCon = ConfigurationManager.ConnectionStrings["Sql-ConnString-Token"].ToString();
            fConectaBase(oCon, gStrCon);
            fProcessa();
        private static void fProcessa()
            try
                do
                    Thread.Sleep(gIntervalo);
                while (true);
            catch (Exception)
        internal static bool fConectaBase(SqlConnection pCon, string pConnectionString = "")
            if (pCon.State != ConnectionState.Closed)
                pCon.Close();
            pCon.ConnectionString = (pConnectionString == "") ? pCon.ConnectionString : pConnectionString;
            pCon.Open();
            return true;

Hello Pramod,
>>I have an application in which windows handle count keeps increasing
If the windows handle(I assume you mean the object handles in Taks Manager bar) keeps increasing, it should means that the project keeps allocating new objects and does not close/dispose them. I notice that you are using ADO.NET API, I am wondering how you
manage these connections, do you close/dispose the connection immediately after using them? If not, please do it and it is recommended.
Please check if you call method to close/dispose connections in a finalize method, if so, this is not recommended since in a finalize method, these connections object would still keep alive and does not return to the connection pool, and for new connection
request, application might increase more connection number to meet the request.
You could make a test to call GC.Collect() to test if there is a memory leak, if it has, you could check this
article, or it could be also a handle leak, this
blog might be helpful for it.
Regards.
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey.

Similar Messages

  • RMAN Connections To Primary DB While Creating Standby With Active Database

    OS Version : AIX 6.1
    DB Version : 11.2.0.1
    I am creating a standby database with active database option (without any backups). When i am checking number of connections in my primary database, i can see 3 rman connections
    from the standby machine. How oracle reaches to a conclusion of 3 sessions ? Is this number fix or this number can be manipulated with requirment ?
    SQL> select sid,serial#,program from v$session;
           SID    SERIAL# PROGRAM
             1          1 oracle@cph-core-db01-s (DIA0)
             2          1 oracle@cph-core-db01-s (MMNL)
             3          1 oracle@cph-core-db01-s (QMNC)
            32          1 oracle@cph-core-db01-s (MMAN)
            33          1 oracle@cph-core-db01-s (DMON)
            34          3 oracle@cph-core-db01-s (Q000)
            63          1 oracle@cph-core-db01-s (PMON)
            64          1 oracle@cph-core-db01-s (DBW0)
            65          3 sqlplus@cph-core-db01-s (TNS V1-V3)
            66         10 oracle@cph-core-db01-s (Q001)
            94          1 oracle@cph-core-db01-s (VKTM)
           SID    SERIAL# PROGRAM
            95          1 oracle@cph-core-db01-s (LGWR)
            96          3 oracle@cph-core-db01-s (INSV)
            *97         27 rman@cph-core-db02-s (TNS V1-V3)*
           125          1 oracle@cph-core-db01-s (GEN0)
           126          1 oracle@cph-core-db01-s (CKPT)
           127          3 oracle@cph-core-db01-s (ARC0)
           *129         18 rman@cph-core-db02-s (TNS V1-V3)*
           156          3 oracle@cph-core-db01-s (ARC1)
           157          1 oracle@cph-core-db01-s (DIAG)
           158          1 oracle@cph-core-db01-s (SMON)
           159         12 oracle@cph-core-db01-s (SMCO)
           SID    SERIAL# PROGRAM
           187          1 oracle@cph-core-db01-s (DBRM)
           188          1 oracle@cph-core-db01-s (RECO)
           189          1 oracle@cph-core-db01-s (ARC2)
           192          2 oracle@cph-core-db01-s (W000)
           218          1 oracle@cph-core-db01-s (PSP0)
           219          1 oracle@cph-core-db01-s (MMON)
           221          1 oracle@cph-core-db01-s (ARC3)
           *222          3 rman@cph-core-db02-s (TNS V1-V3)*

    Check for the RMAN parallelism in standby database it might be set to 3.
    RMAN> show all;
    or
    Might be you had allocated 3 channels while executing active standby database query.

  • Why does Siri keeps talking with every action I take on the iphone?

    Why does Siri keeps talking with every action I take on the iphone?

    Settings > General > Accessibility > Speak Selection > switch off here

  • HT1491 Why do i keep getting the message 'Cannot connect to iTunes Store' when I have done every connection I can find? What does the error message (-1202) mean when I am on the iTunes site on my computer?

    Why do i keep getting the message 'Cannot connect to iTunes Store' when I have done every connection I can find? What does the error message (-1202) mean when I am on the iTunes site on my computer?

    Hi Velvalee,
    While there may not be specific information about that error, here is an article of steps for troubleshooting connectivity issues with the iTunes store:
    Can't connect to the iTunes Store
    http://support.apple.com/kb/ts1368
    If that article does not help, there is a link near the bottom for an additional article of advanced troubleshooting.
    Cheers!
    - Ari

  • ADF 11.1.1.2 Application Timeout with Active DB Connection

    Hi all,
    just a query really; are we able to set a timeout for an ADF application that has an application module and an active database connection for an extended period of time, such as 10 hours?
    We have previously changed the value in the applications web.xml file to the correct value (600) but when we come to test the app after waiting about 5-6 hours, the application whirls away and throws an error:
    JBO-30019: An unavailable cookie state is detected while attempting to use a cookie from the application SJFG..., session 109imtacg62_...
    Is there another setting we have to apply to Weblogic to increase the cookie state timeout?
    Regards
    Jason

    Hi Mehabub:
    I had the same problem and solved it by checking the Secure Admin Enabled check box and writing the full computer name (domain included) in the Configuration tab of the Server Connection Properties dialog in JDeveloper.
    Hope this helps! Good luck!

  • Why the execution time increases with a while loop, but not with "Run continuously" ?

    Hi all,
    I have a serious time problem that I don't know how to solve because I don't know exactly where it comes from.
    I command two RF switches via a DAQ card (NI USB-6008). Only one position at the same time can be selected on each switch. Basically, the VI created for this functionnality (by a co-worker) resets all the DAQ outputs, and then activates the desired ones. It has three inputs, two simp0le string controls, and an array of cluster, which contains the list of all the outputs and some informations to know what is connected (specific to my application).
    I use this VI in a complex application, and I get some problems with the execution time, which increased each time I callled the VI, so I made a test VI (TimeTesting.vi) to figure out where the problem came from. In this special VI I record the execution time in a csv file to analyse then with excel.
    After several tests, I found that if I run this test VI with the while loop, the execution time increases at each cycle, but if I remove the while loop and use the "Run continuously" funtionnality, the execution time remains the same. In my top level application I have while loops and events, and so the execution time increases too.
    Could someone explain me why the execution time increases, and how can I avoid that? I attached my test VI and the necessary subVIs, as well as a picture of a graph which shows the execution time with a while loop and with the "run continuously".
    Thanks a lot for your help!
    Solved!
    Go to Solution.
    Attachments:
    TimeTesting.zip ‏70 KB
    Graph.PNG ‏20 KB

    jul7290 wrote:
    Thank you very much for your help! I added the "Clear task" vi and now it works properly.
    If you are still using the RUn Continuously you should stop. That is meant strictly for debugging. In fact, I can't even tell you the last time I ever used it. If you want your code to repeat you should use loops and control the behavior of the code.
    Mark Yedinak
    "Does anyone know where the love of God goes when the waves turn the minutes to hours?"
    Wreck of the Edmund Fitzgerald - Gordon Lightfoot

  • Why can't I continue with activation?

    I just restored my Iphone and now it says it can't proceed with activation?

    Most likely your phone was previously hacked to carrier unlock. When you restored it was re-locked to its original carrier and will acitivate only with that carrier, using their SIM card.

  • JCAP512 and JCAP6 conflict with concurrent database connectivity

    So here is the situation:
    Environment:
    - We have a production JCAP6 appserver (AIX server 1) running a project pulling data from database A
    - We have 4 JCAP512 domains on AIX Servers 2,3,4 running 4 distinct projects pulling data from server A
    - All project run on a schedule of 5 minutes and login to the server with the same login
    - Database A is SQL Server
    - repository based code
    Scenario:
    - All 5 above processes run concurrently in the greater JCAPS environment.
    - When all 5 processes are running, the JCAP6 process runs fine with no issue but at the same time the 4 JCAP512 processes hang on the database side waiting for a resultset with a wait status of ASYNC_NETWORK_IO
    - As soon as the JCAP6 process completes, all 4 JCAP512 processes start running with no errors. Once the JCAP6 process starts again, same result.
    - We shut off the JCAP6 process and all 4 JCAP512 processes run with no issue
    So after my high-school proof setup above my question comes to what is going on??? All of these processes run on their own isolated physical and application servers. Their only commonaliy is the login to the database. Are there any known database connectivity settings that would limit user transactions if another (same) user connection currently exists?
    Has anybody seen anything like this? Ay assistance would be greatly appreciated.
    Bryan
    Edited by: bgrant88 on Jan 29, 2010 2:15 PM

    I've never worked with the old version of the toolkit, so I don't know how it did things, but looking inside the SQL prep VI, it only generates a command, and the the column name VI wants a recordset. I'm not super familiar with all the internals of ADO, but my understanding is that is standard - you only have the columns after you execute the command and get the recordset back. What you can apparently do here is insert the Execute Prepared SQL VI in the middle and that will return what you need.
    I'm not sure why it worked before. Maybe the execute was hidden inside the prep VI or maybe you can get the column names out of the command object before execution. In general, I would recommend considering switching to the newer VIs.
    Try to take over the world!

  • Why does Home Sharing require an active internet connection?

    I have noticed when my internet goes down I have real difficulty streaming content to my Apple TV from my iMac. I can see it but I get stuck on the spinning clock. Some audio works OK but video not. This makes no sense. I shouldn't need any internet to access content on a local device.
    It seems to be by design, per Troubleshooting Home Sharing (n.4) "Home Sharing requires a home network with an active Internet connection."
    But why can I play music but not TV shows? And why is there not an error message instead of spin? In any case why require it at all? I reset the home wireless, and the modem. My ISP confirmed there was cable trouble at that time. When the internet went back up, home sharing worked.

    Thanks for the many many replies, Apple User Community. Apple seems to have removed this requirement with the latest software update (7.0.1) for the Apple TV .

  • Problem With Midlet Database Connectivity

    Hi, I am into an application which reures database connectivity.I want to connect to Ms Access as backend with JDBC support.Ive searched a lot but found RMS as the only answer.I will be very thankful if some one can send me a code snippet or some link to an article which shows the trail to my problem.

    You can't have an MS Access database on the phone itself. And even if you can (on an MS SmartPhone maybe?), MIDP has no way to connect to it.
    But if you need to connect to a database that's hosted on a server, then what you have to do is set up a regular web server (using ASP, Servlets, PHP, whatever you fancy), and communicate with this server using the General Connection Framework (that's the javax.microedition.io.* classes). The web server, instead of outputting data in HTML format, can output the data in a format you design and know how to read and parse on your MIDlet (for example, for a simple application a comma separated string will do, for something more complicated maybe you want to use XML, or even develop your own binary format).
    If you want the data to be stored on the client then I'm afraid you're stuck with the RMS.
    shmoove

  • I just downloaded find my iphone.  Why does it keep saying I am not connected to the internet when I know i am?

    I am trying to get my "Find my Iphone" app to work and after I sign in with my apple id and password, it keeps telling me Im not connected to the internet.  I click "try again" and it does nothing.   I double checked that I am connected to my local wi-fi and not sure what else to do.   Help!!

    Yes...i have tried that and it sure does connect to all the websites. 

  • Active Database Connections?

    Hi,
    I'm trying to decide whether to use EJB's for a distributed application I'm creating. I would like to update client state when the database itself is modified. Do entity beans have a live connection with the database tuples they map to. If an external user modifies the database will the database signal to the entity EJB that a change has been made?

    The entity bean would not be notified if the tuple in the database changes.
    Whenever a business method is called on the entity bean it will first call ejbLoad during which it will synchronize its state with the database. Then the business method will be invoked. After that, ejbStore will be called which submits the changes to the database. This is as per EJB specification. Some implementation like WebLogic give you parameters in the deployment descriptors to limit the calls to ejbLoad and ejbStore for each call on business method.

  • Why is the data source not getting database connection without  exception?

    experts,
    I am trying to config server.xml to get database connection. i am now getting no exception duing the connection, but the returned connection is NULL, why? thanks/ this is my codes:
    public synchronized Connection getConnection()
    try{
    Context ctx = new InitialContext();
    if (ctx == null)
    throw new Exception("Context is null");
    Context initContext = new InitialContext();
    Context envContext = (Context)initContext.lookup("java:/comp/env");
    DataSource ds = (DataSource)envContext.lookup("test");
    Connection conn = ds.getConnection();
    }catch(Exception ex)
    ex.printStackTrace();
    return conn;
    }

    Remove the first slash after "java:".
    Context envContext =(Context)initContext.lookup("java:comp/env");

  • Can anyone help me ? my iphone 3gs keeps displaying needs activation and connect to itunes when i do this nothing happens but the phone works fine but as soon as i disconect the phone it displays the same message over again and wont let me go any further

    my phone has just suddenly stopped working today was fine this morning then suddenly showed a message saying needs activating and connect to i tunes . i connected it to itunes and nothing happened but phone started to work fine  so i disconected it from the laptop it worked fine untill it went to lock then showed the same message again .please can anybody help as i am ready tear my hair out!

    In settings>general> cellular do you have it  turned ON?

  • [SAP CRM] How to get just the hit count of objects with a database query?

    Hello,
    i need help. For performance reasons I dont want to get the query result with all the objects from the database. I just want to send a request / query to the database in order to know how many entries are there available with my search parameters.
    At the moment I load all the objects via class cl_crm_bol_dquery_service and the method get_query_result in an internal collection. And after that I call the method size in my collection object. But to gain better performance I just want to know the count. With standardized select statements I would take the select count statement, but in this case it is not possible.
    So I tried to call the retrieve_hit_count method, but I will receive the exception cx_sy_no_handler anytime.
    I would be very pleased to receive an answer <removed by moderator>.
    Thank you very much!
    Marcus
    Edited by: Thomas Zloch on Feb 16, 2011 1:45 PM - priority normalised

    It will be 0 before the call method statement and 1 during exception handling.
    The exception starts in CL_CRM_BOL_DQUERY_SERVICE=>RETRIEVE_HIT_COUNT when the system tried to perform the following statement:
      Return hit count if already available
        rv_hit_count = me->handle->get_hit_count( ).
    The handle variable seems to be empty. But why?
    Edited by: Marcus Findeisen on Feb 17, 2011 9:24 AM
    Edited by: Marcus Findeisen on Feb 17, 2011 9:27 AM

Maybe you are looking for

  • How can I install iCloud on a Windows phone?

    I have family members who have iPhones and use the "Find Friends" app to keep in touch.  I moved from an iPhone to a Windows phone and have purchased "Find Friends" based on the claim that it can be used on a Windows phone if you have iCloud.  I have

  • Missing Ordered Qty in AR Invoice

    Hi all With reference to SAP Support Message 306166, Qty Ordered is always blank in AR Invoice transaction when a single AR Invoice is copied from two Delivery Orders whether or not there is partial delivery. Please help to feedback to your developme

  • Target mode

    I recently bought a mac mini to replace my old imac g5 (17" with ambient light ver. 10.4.11, power pc) that quit on me. I've been reading about target mode to hopefully extract or retrieve files from my old mac. I have not done it yet but the only th

  • SAP-BO BI 4.0 SP2 (Patch 7)...?

    Setting-up a new "Sandbox" server later this week on Windows Server 2008 (R2) - 64 bit OS. It looks like the current version I should be deploying is SAP-BO BI 4.0 SP2 Patch 7. Do I need to apply Patch 7 - or should I just use the regular SAP-BO BI 4

  • Satellite L650-1MT - WLan driver for Windows 7 x64 doesn't works

    Hallo Support-forum-member, i reinstalled my Windows, because my old hard-drive was damaged. Now I have Windows 7 x64. By installing the hardware drivers from the Toshiba homepage I had a problem with the W-Lan driver. It has an Atheros W-Lan Adapter