Skip to Main Content

ODP.NET

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

"Connection request timed out" (ODP-1000)

2739902Aug 31 2014 — edited Sep 25 2014

Hi All,

I'm having trouble with threaded code which I'm using with the Oracle ManagedDataAccess.dll. To simulate the issue I have created a small test application that opens a connection, does a query and closes the connection.

The thing that happens is that randomly a "Connection request timed out" (ODP-1000) occurs in the conn.open() statement when I run this code. Now I have done plenty of Googeling out there and it tells me that the pool size is too small, however this is not the case here because then I would get a "Pool connection timed out" exception (ODP-1012). I have played around with the connection string properties as well, and in the test application I can get it to war flawlessly when I set a greater "connection timeout" property, but the point is that this doesn't help me with the application I'm working on.

Any help or insight would be greatly appreciated!

    class Program

    {

        static readonly object _object = new object();

        static string connectionstring = @"Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=oralinux.contoso.com)(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=DB)));User Id=system;Password=xxxxxx;Pooling=True;Min Pool Size=;Max Pool Size=20;Incr Pool Size=10;Decr Pool Size=1;Connection Lifetime=0;Connection Timeout=1;Self Tuning=false";

        static string query = "select to_char(max(end_time),'Mon-DD-YYYY HH24:MI:SS') \"SPFILE\" from V$RMAN_STATUS where object_type='SPFILE' and status='COMPLETED'";

        static void Main(string[] args)

        {

            for (int i = 0; i < 1000; i++)

            {

                Thread myNewThread = new Thread(DoWork);

                Console.WriteLine(i.ToString());

            }

        }

static void DoWork()

        {

            lock (_object)

            {

                DataTable dt = new DataTable();

                using (OracleConnection conn = new OracleConnection(connectionstring))

                {

                

                    conn.Open();

                

                    using (OracleCommand cmd = new OracleCommand(query, conn))

                    {

                        using (OracleDataAdapter adap = new OracleDataAdapter(cmd))

                        {

                            adap.Fill(dt);

                        }

                        while (conn.State != ConnectionState.Closed) conn.Close();

                    }

                    conn.Dispose();

                }

            }

        }

    }

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 23 2014
Added on Aug 31 2014
1 comment
5,227 views