THIS IS MY CODE
using System; using System.Collections.Generic; using Oracle.DataAccess.Client; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Insert { class Program { static void Main() { Console.WriteLine("Start...."); String connString = "User Id=******;Password=*********;Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=***.**.**.***)(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=****))); Connection Timeout=5"; Console.WriteLine("connString was created...."); try { Console.WriteLine("start using sentence...."); using (OracleConnection connection = new OracleConnection(connString)) { Console.WriteLine("in using scope....before connection opens...."); connection.Open(); OracleCommand cmd = connection.CreateCommand(); Console.WriteLine(connection.ServerVersion); Console.WriteLine("Myworld"); cmd.CommandText = String.Format("INSERT INTO PROCESS_TEST ( TEST ) VALUES ( {0} )", "1"); cmd.ExecuteNonQuery(); cmd.CommandText = "SELECT TEST FROM PROCESS_TEST"; OracleDataReader read = cmd.ExecuteReader(); while (read.Read()) { Console.WriteLine(read.GetString(0)); } connection.Close(); } } catch (Exception e) { Console.WriteLine(e.StackTrace); Console.Read(); } } } }
IT WORKS If I ran the code on my visual studio 2013.
DOES NOT WORK when I run exe in the Release folder.
I inserted the try-catch code later to find out what is happening, but it does not cause any error, no matter how long I wait for my exe to give an error. This is strange considering that the connection timeout is set to 5 seconds ...

This does not go beyond this step. Running exe with administrator privileges also does not work.
Let me say again, it works very well at my visual studio 2013
What is the problem with this?
UPDATED
It turns out that my code works fine either with .exe after , except that it accidentally takes 3 ~ 10 minutes to finish the job, which I don’t want either.
Why open the connection for so long? Can a connection work as long as 4 ~ 10 minutes when the application is running under a standalone process, for example exe?
This is a working database server for my web application and the connection task has never bothered me before.
My exe does the rest of its work (insert work), quickly trying while the connection is open.
source share