Jambhalheart Posted March 23, 2011 Report Posted March 23, 2011 one technical doubt....I have never worked in oracle... current the database of my project is in oracle...suppose from any front end application like .net or java, we have created a new connection or instance to the database to fetch or pass data from front end. Now, the problem we r experiencing is if one programmer makes a connection with database, this connection does not expired even thou he closes the file... if he tries for another connection, a new connection will be created altogether(with first connection being still alive)....so this has been a problem for us... we want to manually close that connection but don't know how to do it... and our oracle DB team totally sucks :(I know its very simple but don't know how to solve it....
chipanjichiru Posted March 23, 2011 Report Posted March 23, 2011 What I am thinking is you are forgetting to close the connection after opening...Sqlconnection (or OleDBConnection) conn = new Sql Conbnection (CONNECTIONSTRING);conn.open() //opens the connection......Write your codeconn.close() // This is very important to close the connection.Is this you want or something else?
htnamus Posted March 23, 2011 Report Posted March 23, 2011 [quote author=TollywoodEmperor link=topic=171708.msg2085419#msg2085419 date=1300903155]What I am thinking is you are forgetting to close the connection after opening...Sqlconnection (or OleDBConnection) conn = new Sql Conbnection (CONNECTIONSTRING);conn.open() //opens the connection......Write your code[b]conn.close()[/b] // This is very important to close the connection.Is this you want or something else?[/quote]shuld work
graham Posted March 23, 2011 Report Posted March 23, 2011 [quote author=TollywoodEmperor link=topic=171708.msg2085419#msg2085419 date=1300903155]What I am thinking is you are forgetting to close the connection after opening...Sqlconnection (or OleDBConnection) conn = new Sql Conbnection (CONNECTIONSTRING);conn.open() //opens the connection......Write your codeconn.close() // This is very important to close the connection.Is this you want or something else?[/quote]*=:
The QUEEN Posted March 23, 2011 Report Posted March 23, 2011 [quote author=TollywoodEmperor link=topic=171708.msg2085419#msg2085419 date=1300903155]What I am thinking is you are forgetting to close the connection after opening...Sqlconnection (or OleDBConnection) conn = new Sql Conbnection (CONNECTIONSTRING);conn.open() //opens the connection......Write your codeconn.close() // This is very important to close the connection.Is this you want or something else?[/quote] @gr33d @gr33d @gr33d
gkadrikar Posted March 23, 2011 Report Posted March 23, 2011 ma project lo eite idi use chesaruprivate void _RunProc(string procName, OracleParameter[] prams) { // using ensures object is destroyed when it goes out of scope using (OracleConnection oraConn = new OracleConnection(_ConnectionString)) { ExecutionTimer et = new ExecutionTimer(); et.Start(); // Open connection to Oracle oraConn.Open(); // Create new oracle Command OracleCommand oraCmd = new OracleCommand(); oraCmd.Connection = oraConn; oraCmd.CommandText = procName; oraCmd.CommandTimeout = _CommandTimeout; // Set command type oraCmd.CommandType = GetCommandType(procName); // Fill in parameters if ( prams != null ) { for(int i=0; i<prams.Length; i++) { oraCmd.Parameters.Add(prams[i]); } } oraCmd.ExecuteNonQuery(); // Close connecion oraConn.Close(); et.Stop(); if (ConfigurationSettings.AppSettings["OracleTickLogging"]!=null && ConfigurationSettings.AppSettings["OracleTickLogging"]=="true" ) Logging.LogInformation("Oracle", "TickCount: "+et.TickCount.ToString()+" for "+procName); et = null; } }
Jambhalheart Posted March 23, 2011 Author Report Posted March 23, 2011 [quote author=TollywoodEmperor link=topic=171708.msg2085419#msg2085419 date=1300903155]What I am thinking is you are forgetting to close the connection after opening...Sqlconnection (or OleDBConnection) conn = new Sql Conbnection (CONNECTIONSTRING);conn.open() //opens the connection......Write your codeconn.close() // This is very important to close the connection.Is this you want or something else?[/quote]ledhu anna... ala kadhu... we don't write these commands.. we use only Stored procedures and triggers .... normally , we have a WCF which has timeout expection only when we don't pass or fetch data to database in 1 minute(default)... now, suppose a connection is formed with Database and when closed our window or page, .net server releases the object of the .aspx along with all other shitty objects including instances to services,wcf ,etc., ----> this works well in sql server...but in oracle server, u need to hard code at some of time somewhere.... i don't know where it is....
Cheddi Chinnodu Posted March 23, 2011 Report Posted March 23, 2011 make your dbconnection class singleton so that everytime new request vasthe..either it should return an existing connection(if alive) or new connection sSc_hiding2 sSc_hiding2
Jambhalheart Posted March 23, 2011 Author Report Posted March 23, 2011 [quote author=Cheddi Chinnodu link=topic=171708.msg2085509#msg2085509 date=1300903840]make your dbconnection class singleton so that everytime new request vasthe..either it should return an existing connection(if alive) or new connection sSc_hiding2 sSc_hiding2[/quote]anna, nuvvu ekkadiko design patterns lo septhe naa matti burraki ardham kadu.... @3$% emi anukoka pothe, koncham clarify seyava plsss
Jambhalheart Posted March 23, 2011 Author Report Posted March 23, 2011 [quote author=gkadrikar link=topic=171708.msg2085457#msg2085457 date=1300903486]ma project lo eite idi use chesaru oraCmd.CommandTimeout = _CommandTimeout; // Set command type [/quote]r u using web services or WCF by any chance ???we already have this timeout thing in web.config file of WCF.... normally when page or window is closed, the object of .aspx will be released... .net will release all other shitty objects like service objects, proxy objects etc., along with closing the connection ------- > this works well for sql server no doubt...but for oracle, it is playing a bit ....
Cheddi Chinnodu Posted March 23, 2011 Report Posted March 23, 2011 [quote author=Jambhalheart link=topic=171708.msg2085553#msg2085553 date=1300904093]anna, nuvvu ekkadiko design patterns lo septhe naa matti burraki ardham kadu.... @3$% emi anukoka pothe, koncham clarify seyava plsss[/quote].net lo ela cheppalo theliyatam ledhu baa
Jambhalheart Posted March 23, 2011 Author Report Posted March 23, 2011 [quote author=Cheddi Chinnodu link=topic=171708.msg2085601#msg2085601 date=1300904402].net lo ela cheppalo theliyatam ledhu baa[/quote]thats fine mama.. i know singleton is design pattern... apart from that i don't know much about it....
Cheddi Chinnodu Posted March 23, 2011 Report Posted March 23, 2011 [quote author=Jambhalheart link=topic=171708.msg2085625#msg2085625 date=1300904548]thats fine mama.. i know singleton is design pattern... apart from that i don't know much about it....[/quote]nee problem ki if you design class using singleton it should it baa.... adhi ela cheppalo theliyadam ledhu... sSa_j@il sSa_j@il
chipanjichiru Posted March 23, 2011 Report Posted March 23, 2011 [quote author=Jambhalheart link=topic=171708.msg2085491#msg2085491 date=1300903706]ledhu anna... ala kadhu... we don't write these commands.. we use only Stored procedures and triggers .... normally , we have a WCF which has timeout expection only when we don't pass or fetch data to database in 1 minute(default)... now, suppose a connection is formed with Database and when closed our window or page, .net server releases the object of the .aspx along with all other shitty objects including instances to services,wcf ,etc., ----> this works well in sql server...but in oracle server, u need to hard code at some of time somewhere.... i don't know where it is....[/quote] sorry2 sorry2 sorry2 sorry2 sorry2 sorry2 sorry2 I am not sure about that..I think SQL server handles it auto matically..Am I corect? sSc_hiding2
Recommended Posts