OracleTypes vs. java.sql.Types

Discussions

General J2EE: OracleTypes vs. java.sql.Types

  1. OracleTypes vs. java.sql.Types (4 messages)

    If you have a method that does this:

    import oracle.jdbc.OracleTypes;

    ...

        cstmt.registerOutParameter(1, OracleTypes.CURSOR);
        cstmt.setString(2, var1);
        cstmt.setString(3, var2);
        cstmt.setLong(4, var3);

        // execute query
        cstmt.execute();
        rs = (ResultSet) cstmt.getObject(1);

    Would it be ok to use Types.Other? Why the need to use an oracle Cursor?

    Also, what's the difference in " rs = (ResultSet) cstmt.getObject(1);
    " and " rs = cstmt.getResultSet(1);"

    Thanx

    Threaded Messages (4)

  2. hi,

    check out if your question gets answered:
    http://www.onjava.com/pub/a/onjava/2003/08/13/stored_procedures.html?page=2

    Bhagvan K
    http://www.architectcorner.com
  3. Types vs. OracleTypes[ Go to top ]

    Actually I had seen that page, and it poses the same question I am. the author uses an example of making a call and getting a resultset back, but he uses java.sql.Types and the last guy who is asking a question uses what I've typically seen, which is OracleTypes. My question is, why use OracleTypes, wouldn't using sql.Types.CURSOR work?
  4. Types vs. OracleTypes[ Go to top ]

    I know time has passed, but just to let you know, i've ended asking myself the same question. The answer as far as i know is: no you cannot use java.sql.Types.OTHER (java.sql.Types.CURSOR does not exist) instead of OracleTypes.CURSOR.
    You HAVE to use OracleTypes.CURSOR in order for it to work. I believe this is because Oracle wants you to link to their classes and tie you up forever. I cannot see any reason why Types.OTHER wouldn't work exactly as using OracleTypes.CURSOR with an additional runtime checking of the return type.

    Regards,
    Eugenio
  5. Types Vs Oracle Types[ Go to top ]

    Yes Mr.Eugenio said Oracle internal libraries didn't obey java.sql interface specs. similar case for CLOB also. Thanks Sadhasivam Jayabalaganesan