Jump to content

.Net professionals one small doubt...


Recommended Posts

Posted



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....
Posted

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

conn.close() // This is very important to close the connection.


Is this you want or something else?

Posted

[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

Posted

[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

conn.close() // This is very important to close the connection.


Is this you want or something else?
[/quote]

*=:

Posted

[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

conn.close() // This is very important to close the connection.


Is this you want or something else?
[/quote] @gr33d @gr33d @gr33d

Posted

ma project lo eite idi use chesaru

private 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;
}
}

Posted

[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

conn.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....

Posted

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

Posted

[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

Posted

[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 ....

Posted

[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

Posted

[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....

Posted

[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

Posted

[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

×
×
  • Create New...