Oracle FAQ Your Portal to the Oracle Knowledge Grid

Home -> Community -> Mailing Lists -> Oracle-L -> RE: Have you had any issues with

RE: Have you had any issues with

From: Lord David <>
Date: Fri, 9 Jul 2004 15:38:16 +0100
Message-ID: <>


The bug number is 3724758. Fortunately, there's an easy workaround, which is to make sure that you wait until you have got everything from the statement before you close it. Here's the code I used to reproduce the error: -

import java.lang.InterruptedException;
import java.sql.*;

import oracle.jdbc.OracleTypes;

class TestCase {

   public static void main (String args [])

      throws SQLException, IOException, InterruptedException{

// Load the Oracle JDBC driver

      DriverManager.registerDriver(new oracle.jdbc.OracleDriver());

// Prompt the user for connect information

      String user = "enter user here";
      String password = "password here";
      String database = "tns_alias here";

// Connect to the database
// You can put a database name after the @ sign in the connection URL.
System.out.println ("Connecting..."); Connection conn = DriverManager.getConnection ("jdbc:oracle:oci8:@" + database, user, password); System.out.println ("connected.");
// Open a callable statement
System.out.println("Preparing callable statement..."); CallableStatement cs = conn.prepareCall("declare" + " type cv_type is ref cursor;" + " l_cv cv_type;" + " begin" + " open l_cv for select count(*) from dual;" + " :1 := l_cv;" + " end;");
// Register the out parameter
System.out.println("Registering out parameters..."); cs.registerOutParameter(1, OracleTypes.CURSOR);
// Execute the statement
System.out.println("Executing statement..."); cs.execute();
// Close the callable statement
System.out.println("Closing statement..."); cs.close();
// Get the result set
// Crash occurs at this point
System.out.println("Getting result set..."); ResultSet rs = (ResultSet) cs.getObject(1);
// Get the result; int i = rs.getInt(1); System.out.println("Result is " + String.valueOf(i));
// Close the result set
// Close the connection

David Lord 

> -----Original Message-----
> From: Fuad Arshad [] 
> Sent: 09 July 2004 15:08
> To:
> Subject: RE: Have you had any issues with
> can you give some examples we're having  a similar issue on 
> and not sure 
> a bug reference.? the case scenario.?
> Lord David <> wrote:
> Hi,
> We've run into a bug with the JDBC drivers. When trying to 
> get an object
> from a closed CallableStatement object the JVM crashes. It 
> should raise an
> error. It looks like in previous versions, you could do this 
> even though it
> is not strictly allowed.
> Regards
> --
> David Lord 
This email and its attachments are confidential under applicable law and are intended for use of the sender's addressee only, unless the sender expressly agrees otherwise, or unless a separate written agreement exists between Iron Mountain and a recipient company governing communications between the parties and any data that may be so transmitted.  Transmission of email over the Internet is not a secure communications medium.  If you are requesting or have requested the transmittal of personal data, as defined in applicable privacy laws, by means of email or in an attachment to email, you may wish to select a more secure alternate means of transmittal that better supports your obligations to protect such personal data.

If the recipient of this message is not the recipient named above, and/or you have received this email in error, you must take no action based on the information in this email.  You are hereby notified that any dissemination, misuse or copying or disclosure of this communication by a recipient who has received this message in error is strictly prohibited. If this message is received in error, please return this email to the sender and immediately highlight any error in transmittal.  Thank you.

Please see the official ORACLE-L FAQ:
To unsubscribe send email to:
put 'unsubscribe' in the subject line.
Archives are at
FAQ is at
Received on Fri Jul 09 2004 - 09:37:15 CDT

Original text of this message