This discussion is archived
4 Replies Latest reply: Feb 18, 2012 1:01 PM by 918449 RSS

First new OracleConnection() takes 2 mins

870882 Newbie
Currently Being Moderated
The first time I create a new OracleConnection() in my 5 line console spike, it takes two minutes. Subsiquent instances are created instantly.

I am attempting to connect to my local Oracle XE 11g database (beta), using the latest non-beta ODP.Net drivers (ODAC 11.2.0.21, 32 bit). I'm on 64 bit Win 7, but the app is compiled as x86, so running 32 bit. But this happens irrespective of whether I use the ctor overload that takes a connection string, and irrespective of whether the connection string is valid or not. So it's something in the ctor that's not related to actually making a connection. After the first one, subsiquent new OracleConnection instances are returned immediately.

I've replicated this on another machine too, so whatever I misconfigured, I did it twice...

This happens both prior and after to me creating sqlnet.ora / TNSNames.Ora, and irrespective of whether I set SQLNET.Authentication_Services = (NONE) or leave on (NTS).

When I pass the same connection strings through to the (depricated) Microsoft driver (System.Data.OracleClient) it succeeds or fails instantly.

TNSPing to my local XE instance comes back near instantly (either using 'localhost' or 'xe')

I hesitate to post my connection strings here, because, as I said, it happens even if I don't pass the OracleConnection a connection string at all. But they do (eventually) work and connect.

Oh, SQLDeveloper, SQL*plus have no difficulty connecting to the XE instance. It's just the ODN client.

Interestingly this doesn't happen on a 3rd machine that doesn't have XE installed (it just can't connect to the XE instance remotely, but that's a seperate problem)
  • 1. Re: First new OracleConnection() takes 2 mins
    870882 Newbie
    Currently Being Moderated
    Ok, dotTrace tells me the app is spending all the time in OracleConnection.Initialize (but not in it's child calls), which is invoked by OracleConnection's static ctor. So that makes sense why it only happens the first time, but still doesn't tell me what's going on....
  • 2. Re: First new OracleConnection() takes 2 mins
    859874 Newbie
    Currently Being Moderated
    Hi,
    Dont expect someone from oracle develepers to respond to this thread from my experience they just ignoring it.
    But to your problem i have same issue in my web app when im using visual studio develeper web server, i must wait looooong time on first access to db.
    But when i move app to proper iis web server or i choose in project setting to use local iis for debugging it works fine.
    So its related to vs web server.
  • 3. Re: First new OracleConnection() takes 2 mins
    Tridus Journeyer
    Currently Being Moderated
    Best advice I can offer is to grab something like Process Monitor ( http://technet.microsoft.com/en-us/sysinternals/bb896645 ) and Wireshark ( http://www.wireshark.org/ )to try and see what it's really doing during that two minutes. It could be trying to load a lot of files for some reason or trying to connect to something and only starting up after a timeout. Hard to say.

    I've never seen that problem, but I don't connect to XE or any local databases. Our production stuff also uses the "fat" client rather then instant client, but I'm using the instant client with the Entity Framework beta version of ODP.net and it's still playing nice.
  • 4. Re: First new OracleConnection() takes 2 mins
    918449 Newbie
    Currently Being Moderated
    I experience the exact same thing after installing Express Edition 11g Release 2 on Win7 64-bit when running a 32-bit app. I do not even have to create a connection. On the first call to e.g. OracleConnectionStringBuilder the app will hang for 2 minutes within OracleInit.Initialize(), after that all works fine.

    I have monitored the process with the process monitor (from sysinternals) during the time it hangs. And the app is doing...nothing!

    One strange thing is that if I run the same app under the visual studio debugger, the behavior does not appear. And if I change my app, which is a .NET remoting app, so that the first Oracle related call is performed after a call to RemotingConfiguration.Configure instead of before (on the same thread) the problem goes away.

    After this problem started occuring I uninstalled XE, removed everything oracle related from the registry, file system and gac. And I still get the same behavior with an odac xopy install on first connect to any oracle database on remote machines.

    Everything worked fine on the same machine before I installed XE.

    Does anyone have any ideas on this? Any thread/com/coinitialize related problem within odp.net? I know this has been an issue in the past.

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points