Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.tools -> Re: JDBC types for getting a ResultSet from a CallableStatement

Re: JDBC types for getting a ResultSet from a CallableStatement

From: Joseph Weinstein <joe_at_bea.com>
Date: Mon, 07 Jan 2002 10:04:54 -0800
Message-ID: <3C39E346.DCE7EA74@bea.com>

Hi. No other database provides a cursor/resultset as an output parameter value. Most DBMSes provide ResultSets as in-line return data, whether from a direct simple query or from a stored procedure.
Oracle's procedure implementation cannot return query results from a stored procedure in the same way as from a direct simple query, so Oracle made the output parameter option as a workaround. Ie: where most other DBMS drivers would work running a procedure and getting a result set as the return value from the executeQuery() call, Oracle will never succeed with that.

   This is one of the areas where JDBC code will have to be DBMS-specific. Generic JDBC for most DBMSes, and special-casing for Oracle.
Joe

Loren Cahlander wrote:
>
> Hello,
>
> The following is a very stripped down block of code, but it
> gets at the heart of my question. The type used in this
> block of code is specific to the Oracle database driver.
> What types do I need for the other database drivers. I
> remember that there was a java.sql.Types entry to use as
> a general case, but it has been a while since I started
> using this code and I forgot the general case. I would
> appreciate any help.
>
> ============================================================
> CallableStatement stmt= null;
> ResultSet resultSet = null;
>
> stmt = conn.prepareCall("{call GetEmployees(?)}");
>
> stmt.registerOutParameter(1,
> oracle.jdbc.driver.OracleTypes.CURSOR);
> stmt.execute();
> resultSet = (ResultSet)stmt.getObject(1);
> ============================================================
>
> Thanks,
> Loren

-- 
B.E.A. is now hiring! (12/14/01) If interested send a resume to joe_at_bea.com

DIRECTOR OF PRODUCT PLANS AND STRATEGY                  San Francisco, CA
E-SALES BUSINESS DEVELOPMENT REPRESENTATIVE             Dallas, TX
SOFTWARE ENGINEER (DBA)                                 Liberty Corner, NJ
SENIOR WEB DEVELOPER                                    San Jose, CA
SOFTWARE ENGINEER (ALL LEVELS),                         CARY, NORTH CAROLINA San Jose, CA
SR. PRODUCT MANAGER                                     Bellevue, WA
SR. WEB DESIGNER                                        San Jose, CA
Channel Marketing Manager - EMEA Region                 London, GBR
DIRECTOR OF MARKETING STRATEGY, APPLICATION SERVERS     San Jose, CA
SENIOR SOFTWARE ENGINEER (PLATFORM)                     San Jose, CA
E-COMMERCE INTEGRATION ARCHITECT                        San Jose, CA
QUALITY ASSURANCE ENGINEER                              Redmond, WA
Services Development Manager (Business Development Manager - Services) Paris, FRA; Munich, DEU
SENIOR SOFTWARE ENGINEER (PLATFORM)                     Redmond, WA
E-Marketing Programs Specialist EMEA                    London, GBR
BUSINESS DEVELOPMENT DIRECTOR - E COMMERCE INTEGRATION  San Jose, CA
MANAGER, E-SALES                                        Plano, TX
Received on Mon Jan 07 2002 - 12:04:54 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US