Oracle Object with Timestamp problem

Oracle Object with Timestamp problem

Postby Jim Gonzales » Thu 01 Sep 2011 19:06

Recently I had to write some code that called a sproc that had an object with a timestamp attribute in it and found out that after about 12 calls my application would lock up.

If I change the timestamp attribute to a date everything works fine. To test the problem you can create an Oracle Object like this:

Code: Select all
create or replace
TYPE DEVART_TEST_OBJECT as Object
(
TimeStampAttribute TIMESTAMP
);


And use it in a package like this:

Code: Select all
create or replace
PACKAGE BODY DEVART_TEST_PACKAGE AS

  procedure DEVART_TEST_PROCEDURE(request jimg.DEVART_TEST_OBJECT) AS
  BEGIN
    NULL;
  END DEVART_TEST_PROCEDURE;

END DEVART_TEST_PACKAGE;



Then use .NET like this:

Code: Select all
using (OracleConnection _connection = new OracleConnection("your connection string"))
            {
                _connection.Open();
                OracleCommand _command =
                    new OracleCommand("jimg.DEVART_TEST_PACKAGE.DEVART_TEST_PROCEDURE", _connection);

                _command.CommandType =
                    System.Data.CommandType.StoredProcedure;

                OracleType _parameterType =
                    OracleType.GetObjectType("jimg.DEVART_TEST_OBJECT", _connection);
                OracleObject _testObject = new OracleObject(_parameterType);
                _testObject["TimeStampAttribute"] = DateTime.Now;

                OracleParameter _parameter = new OracleParameter("request", OracleDbType.Object);
                _parameter.Direction = System.Data.ParameterDirection.Input;
                _parameter.Value = _testObject;
                _command.Parameters.Add(_parameter);

                _command.ExecuteNonQuery();
                _connection.Close();
            }


I'm using .NET 4, Oracle Client 10.2.0.3 and Dot Connect 6.30.202. I've tried using the Oracle Object Wizard but that didn't help. Any suggestions on how to fix this?
Jim Gonzales
 
Posts: 3
Joined: Fri 15 Oct 2010 17:16

Postby Shalex » Tue 06 Sep 2011 14:51

1.
Jim Gonzales wrote:found out that after about 12 calls my application would lock up.

Do you mean that we should put the "_command.ExecuteNonQuery();" line of your code in the loop to reproduce the issue?

2. Could you please give us the call stack of your application when it hangs?
If the Debug mode of Visual Studio you are running your code from doesn't show call stack, you can obtain it by connecting from another instance of Visual Studio (2nd) (Debug | Attach to Proccess) to the first VS where your application is running. Before attaching don't forget to make these settings in your 2nd Visual Studio: a) in the (Debug | Exceptions) window select Common Language Runtime Exceptions; b) in the (Tools | Options) window, Debugging | General - clear Enable Just My Code (Managed Only).

3. Tell us the version of your Oracle server.

4. Have you tried another version of Oracle client?

We cannot reproduce the problem at the moment using your code with .NET 4, Oracle Client 10.2.0, and dotConnect for Oracle 6.30.202. Looking forward to your reply.
Shalex
Devart Team
 
Posts: 7699
Joined: Thu 14 Aug 2008 12:44


Return to dotConnect for Oracle