Click here to Skip to main content
16,004,587 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I make run of test connection, I expect to see clear session browser, but at the end of the program, I see more than 6 sessions in my session browser
This is the code:
C#
private void testConnection()
{
string connectionString = "data source=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=10.206.2.16)(PORT=1521))(CONNECT_DATA =(SERVER = DEDICATED)(SERVICE_NAME = DEVCALC)));user id=nava_am;password=amrani08;Min Pool Size=10; Connection Lifetime=120;";
OracleConnection oraConn = new OracleConnection(connectionString);
        try
        {
            oraConn.Open();
        }
        catch (Exception e)
        {
        }

        finally
        {
            oraConn.Dispose();    //or without this function
            oraConn.Close();
        }
}

please, help me!!
Posted
Updated 1-Nov-12 8:46am
v2

1 solution

I hope this will help you.

using (OracleConnection oraConn = new OracleConnection(connectionString))<br />
{<br />
            try<br />
        {<br />
        	oraConn.Open();<br />
        	//Do whatever you need<br />
        }<br />
        catch(Exception e)<br />
        {<br />
        	//Handle Exception<br />
        }<br />
        finally<br />
        {<br />
        	if(oraConn != null && oraConn.State != ConnectionState.Closed)<br />
        	{<br />
        		oraConn.Close();<br />
        	}<br />
        }<br />
}
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900