简体   繁体   中英

Keep alive oracle connection in c#

My oracle connection is getting closed before execution of procedure in c#. Oracle procedure takes more than a hour to execute completely.

Please suggest how to keep same connection alive till my procedure return a value.

Its better if you can improve your stored procedure execution time. But if that is not possible, you can set Connection Lifetime so that it will wait, and as response comes back you can close the connection.

Connection Lifetime - Maximum life time (in seconds) of the connection.

con.ConnectionString = 
      "User Id=scott;Password=tiger;Data Source=oracle;" + 
      "Min Pool Size=10;Connection Lifetime=120;Connection Timeout=60;" + 
      "Incr Pool Size=5; Decr Pool Size=2";

You can find more details here. https://docs.oracle.com/cd/B28359_01/win.111/b28375/featConnecting.htm

With Devart dotConnect for Oracle, please increase your value of either OracleCommand.CommandTimeout or "Default Command Timeout=your_value;"in connection string.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM