6 Replies Latest reply on Jan 29, 2015 3:58 PM by user10875959

    Connection.Open() hangs

    user10875959

      We have a Windows 2008R2 Server with the 64bit Oracle client installed.

      I have confirmed it is working and configured properly by creating a test.udl and successfully testing the connection.

      Even if I copy the connection string from the test.udl (including user and password info) and paste it into an ASP.Net page when I call myconnection.Open() the page hangs.

      Static pages work fine on the web server as do ASP.Net pages that do NOT attempt to connect to a database.

      I've verified everything is 64bit (application pool, OS, oracle client).

      No error is ever returned.  I've tried wrappoing the myconnection.Open() in a try block to no avail.  From the browser the page just hangs for MINUTES then eventually you get the standard page cannot be displayed error.  I don't know if it's oracle or IIS or what but I'm at a loss with no error message to look up, non-db asp.net pages working fine, and the udl testing successfully.

       

      Any assistance would be greatly appreciated.

        • 1. Re: Connection.Open() hangs
          svenkatn-Oracle

          Hi,

           

          When your udl test is successful that ensures that database connectivity through Oracle Client software is not an issue.

          You can try with below Vbsrcipt code and evaluate whether you get the data requested from database.

          Copy the below code in notepad, modify the connection string credentials as per your environment and save the file as "Test.vbs".

          ==================================================================================

          set con = createobject("adodb.connection")

          con.open "provider=oraoledb.oracle;user id=UserId;password=Password;data source=OracleDBName;"

          set rs = createobject("adodb.recordset")

          rs.open "SELECT * FROM V$VERSION", con

          intCount = rs.Fields.Count

          wscript.echo "The DB version is :"

          do while not rs.EOF        'loop to cycle through the table

          for i = 0 to intCount-1     'column count

             wscript.echo rs.fields.item(i)

          next

          rs.MoveNext

          loop

          wscript.sleep 5000

          ==================================================================================

           

          Save the file in a subfolder, for ex  C:\\temp\Test.vbs. If the code executes successfully you should see the DB version details.

           

          thanks and regards

          Venkat

          Oracle Support

          • 2. Re: Connection.Open() hangs
            2833196

            The difference between the Data Link Properties dialog box and IIS may be something like permissions because user acconts these processes use may be different.

            I don't know whether it can cause hangs though.

             

            If you comment-out "myconnection.Open()" in the page then does it hang?

            If you intentionally set a wrong connection string in the page then does it hang?

            • 3. Re: Connection.Open() hangs
              2833196

              Some invisible error dialog may possibly cause hangs.

              ADPlus told me that OraOLEDB10 can call user32!MessageBoxA in the old days.

              In my case, the difference was not permissions but the value of environment variable "PATH". "Reboot" solved the problem.

               

              If you intentionally set a wrong provider name in the connection string then does it hang?

              • 4. Re: Connection.Open() hangs
                svenkatn-Oracle

                Good to know that your issue is resolved by setting the PATH variable.

                 

                If you set the wrong provider there is a slight delay but it is negligible. It errors out within second/s.

                If the connection.Open is commented then you see the response immediately saying connection is invalid or closed.

                 

                thanks and regards

                Venkat

                Oracle Support

                • 5. Re: Connection.Open() hangs
                  2833196

                  If you comment-out "myconnection.Open()" in the page then does it hang?

                  If you intentionally set a wrong connection string in the page then does it hang?

                  If you intentionally set a wrong provider name in the connection string then does it hang?

                  I want to know whether OraOLEDB causes this issue and whether connecting to user10875959's database causes this issue.

                   

                  Good to know that your issue is resolved by setting the PATH variable.

                  I don't know whether my case has relation to user10875959's case.

                  In my case in the old days:

                  1. IIS process loads old value of the "PATH".
                  2. Oracle Installer changes the value of the "PATH".
                  3. A new process loads new value of the "PATH" and it can connect to the database.
                  4. a child process started by IIS seems to use old value of the "PATH" copied from IIS and it can "not" connect to the database. The reason may be that OraOLEDB10 fails to find OraOleDbPus10.dll and it shows "invisible" error dialog.
                  5. "Reboot" forces IIS to load new value of the "PATH".
                  • 6. Re: Connection.Open() hangs
                    user10875959

                    I believe the issue was PATH related.

                    I'm not 100% sure because I'm a developer not a sys admin but after the sys admins said it wasn't on their end and banging my head against the wall for a week (culminating in my post here) they fixed it.  I weren't forthcoming on EXACTLY what they did to fix is but their vague description did sound like the PATH variable wasn't set (or being read) properly.

                     

                    To answer some of the other questions here just in case others find this and a search and have similar issues though:

                     

                    If I comment out the connection.Open() then yes, the rest of the asp.net page works (well, the parts that don't rely on an open connection of course).  ASP.NET was working fine in general.

                     

                    connection.Open() with a bogus connection string resulted in the same hang.

                     

                    This would have been MUCH easier of to track down if IIS had actually displayed an error in finding OraOleDbPlus10.dll (in the event log or somewhere) but that's on MS not Oracle and it's solved now so much thanks for the assistance.