This discussion is archived
4 Replies Latest reply: Apr 3, 2013 12:55 PM by jschellSomeoneStoleMyAlias RSS

Is oracle.sql.ArrayDescriptor threadsafe ?

1000322 Newbie
Currently Being Moderated
Once initialized, is an instance of oracle.sql.ArrayDescriptor threadsafe ?
The API [http://docs.oracle.com/cd/E16338_01/appdev.112/e13995/oracle/sql/ArrayDescriptor.html] for this class does not mention anything about thread safety.

Edited by: user13289193 on Apr 1, 2013 9:31 AM
  • 1. Re: Is oracle.sql.ArrayDescriptor threadsafe ?
    Joe Weinstein Expert
    Currently Being Moderated
    I would say not. All 'live' JDBC objects are related to and may use the connection
    from which they came, and JDBC is 99.9% intended to be single-threaded per
    connection.
  • 2. Re: Is oracle.sql.ArrayDescriptor threadsafe ?
    1000322 Newbie
    Currently Being Moderated
    I think you're most likely correct.
    Any Oracle employees, can you confirm that an instance of oracle.sql.ArrayDescriptor is not thread-safe ?
  • 3. Re: Is oracle.sql.ArrayDescriptor threadsafe ?
    rp0428 Guru
    Currently Being Moderated
    >
    Once initialized, is an instance of oracle.sql.ArrayDescriptor threadsafe ?
    The API [http://docs.oracle.com/cd/E16338_01/appdev.112/e13995/oracle/sql/ArrayDescriptor.html] for this class does not mention anything about thread safety.
    >
    This statement from the JDBC Dev Guide is the only one I have seen from an Oracle source.

    >
    JDBC and Multithreading
    Oracle JDBC drivers provide full support for, and are highly optimized for, applications that use Java multithreading. Controlled serial access to a connection, such as that provided by connection caching, is both necessary and encouraged. However, Oracle strongly discourages sharing a database connection among multiple threads. Avoid allowing multiple threads to access a connection simultaneously. If multiple threads must share a connection, use a disciplined begin-using/end-using protocol.
  • 4. Re: Is oracle.sql.ArrayDescriptor threadsafe ?
    jschellSomeoneStoleMyAlias Expert
    Currently Being Moderated
    user13289193 wrote:
    The API [http://docs.oracle.com/cd/E16338_01/appdev.112/e13995/oracle/sql/ArrayDescriptor.html] for this class does not mention anything about thread safety.
    Which is true of everything in the Java API. If it does not say it is thread safe, then it isn't.
    Once initialized, is an instance of oracle.sql.ArrayDescriptor threadsafe ?
    Why exactly does it matter?

    It is only used with Arrays. Which means that you are creating/using an oracle.sql.ARRAY. And thus you are using those in multiple threads. At best you (or someone) thinks that they are gaining something by creating it once and then using it with multiple connections. They are not gaining anything.

    But at worst multiple threads are attempting to use the same ARRAY/Connection and that is definitely a bad idea.

Legend

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