Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4263244

Hotspot breaks JDBC CallableStatement with output parameters

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Cannot Reproduce
    • Icon: P4 P4
    • None
    • 1.3.0
    • hotspot
    • x86
    • windows_nt



      Name: mc57594 Date: 08/17/99


      Using the jdk1.2.2 classic VM output parameter is correctly returned. When using the hotspot VM I get a NumberFormatException.

      VM info after I removed the hotspot vm.
      E:\work\java\Tests\Project25>E:\jdk1.2.2\bin\java.exe -version
      java version "1.2.2"
      Classic VM (build JDK-1.2.2-W, native threads, symcjit)

      E:\work\java\Tests\Project25>E:\jdk1.2.2\bin\java.exe -fullversion
      java.exe full version "JDK-1.2.2-W"

      example code.

      import java.io.*;
      import java.util.*;
      import java.sql.*;

      import sun.jdbc.odbc.*;

      /**
       * This class can take a variable number of parameters on the command
       * line. Program execution begins with the main() method. The class
       * constructor is not invoked unless an object of type 'Class1'
       * created in the main() method.
       */
      public class Class1
      {
      // Database settings.
      public static final String DB_UID_NAME = "sa";
      public static final String DB_PASSWORD_NAME = "";
      public static final String DB_DRIVER_NAME = "sun.jdbc.odbc.JdbcOdbcDriver";
      public static final String DB_CONNECTION_NAME = "jdbc:odbc:BugSystem";

      public static void main (String[] args)
      {
      DoAddBug();
      }

      private static void DoAddBug()
      {
      Connection m_DBConnection;
      try
      {
      // Open the Database connetion
      Class.forName(DB_DRIVER_NAME);
      m_DBConnection = DriverManager.getConnection( DB_CONNECTION_NAME, DB_UID_NAME, DB_PASSWORD_NAME );

      /*
      Alter PROCEDURE sp_Bugs_Create( @bugname varchar(50),
      @bugseverityname varchar(50),
      @bugproductname varchar(50),
      @bugdescription varchar(255),
      @reporterUID int,
      @ownerUID int ) AS

      DECLARE @bugid int
      DECLARE @bugseverityid int
      DECLARE @bugproductid int
      DECLARE @bugopened datetime

      SELECT @bugseverityid = BugSeverityID FROM tbl_Bugseveritys WHERE BugSeverityName = @bugseverityname
      SELECT @bugproductid = ProductId FROM tbl_Products WHERE ProductName = @bugproductname
      SELECT @bugopened = GetDate()

      exec @bugid = sp_Bugs_Insert @bugname, @bugopened, NULL, @bugseverityid, NULL, @bugproductid, @reporterUID, @ownerUID, @bugdescription, NULL

      RETURN @bugid
      */

      CallableStatement stmt = m_DBConnection.prepareCall("{?= call sp_Bugs_Create(?,?,?,?,?,?)}");

      stmt.setString(2, "Bug Title" );
      stmt.setString(3, "Wish List" );
      stmt.setString(4, "Consort" );
      stmt.setString(5, "Bug Desc" );
      stmt.setInt( 6, 1 ); stmt.setInt( 7, 1 );
      stmt.registerOutParameter(1, java.sql.Types.INTEGER );

      stmt.execute();

      int bugid = stmt.getInt(1); // <-------------WITH HOTSPOT get a NumberFormatException here, normal VM works fine?
      System.out.println( "bugID=" + bugid );

      stmt.close();

      // close the Database connection
      m_DBConnection.close();
      m_DBConnection=null;
      }
      catch(SQLException sqle)
      {
      System.out.println("SQLException = " + sqle.toString() );
      }
      catch(ClassNotFoundException cnfe)
      {
      System.out.println("ClassNotFoundException = " + cnfe.toString() );
      }
      }
      }
      (Review ID: 94003)
      ======================================================================

            jmasa Jon Masamitsu (Inactive)
            mchamnessunw Mark Chamness (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: