Java Solaris Communities Sun Store Join SDN My Profile Why Join?
 
Bug Database
Bug Detail
Quick Lists
Top 25 Bugs
Top 25 RFE's
Recently Closed Bugs
Printable Page Printable Page


Bug Database
Bug ID: 4546083
Votes 0
Synopsis Updatable ResultSet in jdbc-odbc doesn't work in 1.4 beta3
Category jdbc:jdbc_odbc_bridge
Reported Against merlin-beta3
Release Fixed
State 11-Closed, duplicate of 4486195, bug
Priority: 3-Medium
Related Bugs 4486195
Submit Date 04-DEC-2001
Description




java version "1.4.0-beta3"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-beta3-b84)
Java HotSpot(TM) Client VM (build 1.4.0-beta3-b84, mixed mode)


--- Test2.java
import java.sql.*;
import java.util.*;

public class Test2
{
 static void dump(byte[] buf)
 {
  for(int i=0; i<buf.length; i++)
    {
     int v = buf[i] & 0xff;
     System.out.print( Character.forDigit(v >> 4,16) );
     System.out.print( Character.forDigit(v & 0xf,16) );
    }

  System.out.println();
 }

 static void showTable(Statement stmt) throws Exception
 {
  ResultSet rs = stmt.executeQuery("SELECT Val FROM Test");

  while( rs.next() )
    {
     dump( rs.getBytes(1) );
    }

  rs.close();
 }

 static void tryUpdateString(Connection db) throws Exception
 {
  Statement rsstmt = db.createStatement
    (ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE);


  ResultSet rs = rsstmt.executeQuery("SELECT Val FROM Test");

  rs.first();
  rs.updateString(1,"DEF");

  rs.updateRow();

  rs.next();
  rs.updateString(1,"\u0413\u0414\u0415");

  rs.updateRow();
  rs.close();
  rsstmt.close();
 }

 static void tryUpdateBytes(Connection db) throws Exception
 {
  Statement rsstmt = db.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE);


  ResultSet rs = rsstmt.executeQuery("SELECT Val FROM Test");

  rs.first();
  rs.updateBytes(1,"DEF".getBytes());

  rs.updateRow();

  rs.next();
  rs.updateBytes(1,"\u0413\u0414\u0415".getBytes("Cp1251"));

  rs.updateRow();
  rs.close();
  rsstmt.close();
 }

 public static void main(String[] args) throws Exception
 {
  Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");

  Properties connInfo = new Properties();

  connInfo.put("charSet","Cp1251");

  Connection db = DriverManager.getConnection("jdbc:odbc:test", connInfo);

  DatabaseMetaData dbmeta = db.getMetaData();

  System.out.println("Database: "+dbmeta.getDatabaseProductName()+ ", ver. "+dbmeta.getDatabaseProductVersion());

  System.out.println("Driver: "+dbmeta.getDriverName()+ ", ver. "+dbmeta.getDriverVersion());


  Statement stmt = db.createStatement();

  try
    {
     stmt.executeUpdate("DROP TABLE Test");
    }
  catch (Exception ignore) {}

  stmt.executeUpdate("CREATE TABLE Test (Val VARCHAR(10))");
  stmt.executeUpdate("INSERT INTO Test (Val) VALUES ('ABC')");
  stmt.executeUpdate("INSERT INTO Test (Val) VALUES ('\u0410\u0411\u0412')");

  showTable(stmt);

  if( args.length==0 )
    {
     tryUpdateString(db);
     showTable(stmt);
    }
  else
    {
     tryUpdateBytes(db);
     showTable(stmt);
    }

  db.close();
 }
}
---

Create new database with MS Access 97, and execute this.

>java Test2
Database: ACCESS, ver. 03.50.0000
Driver: JDBC-ODBC Bridge (ODBCJT32.DLL), ver. 2.0001 (04.00.6019)
414243
c0c1c2

An unexpected exception has been detected in native code outside the VM.
Unexpected Signal : EXCEPTION_ACCESS_VIOLATION occurred at PC=0x7800D0C8
Function=[Unknown.]
Library=(N/A)

NOTE: We are unable to locate the function name  customer  for the error
      just occurred. Please refer to release documentation for possible
      reason and solutions.


Current Java thread:
	at sun.jdbc.odbc.JdbcOdbc.ReleaseStoredBytes(Native Method)
	at sun.jdbc.odbc.JdbcOdbcResultSet.FreeCols(JdbcOdbcResultSet.java:1514)
	- locked <028237B0> (a sun.jdbc.odbc.JdbcOdbcResultSet)
	at sun.jdbc.odbc.JdbcOdbcResultSet.updateRow
(JdbcOdbcResultSet.java:4055)
	at Test2.tryUpdateString(Test2.java:47)
	at Test2.main(Test2.java:108)

Dynamic libraries:
0x7D6F0000 - 0x7D70D000 	C:\WINDOWS\SYSTEM\IMAGEHLP.DLL

Local Time = Mon Nov 12  customer :19:38 2001
Elapsed Time = 7
#
# The exception above was detected in native code outside the VM
#
# Java VM: Java HotSpot(TM) Client VM (1.4.0-beta3-b84 mixed mode)
#
# An error report file has been saved as hs_err_pid4294516309.log.
# Please refer to the file for further information.
#

>java Test2 1

Database: ACCESS, ver. 03.50.0000
Driver: JDBC-ODBC Bridge (ODBCJT32.DLL), ver. 2.0001 (04.00.6019)
414243
c0c1c2

An unexpected exception has been detected in native code outside the VM.
Unexpected Signal : EXCEPTION_ACCESS_VIOLATION occurred at PC=0x7800D0C8
Function=[Unknown.]
Library=(N/A)

NOTE: We are unable to locate the function name  customer  for the error
      just occurred. Please refer to release documentation for possible
      reason and solutions.


Current Java thread:
	at sun.jdbc.odbc.JdbcOdbc.ReleaseStoredBytes(Native Method)
	at sun.jdbc.odbc.JdbcOdbcResultSet.FreeCols(JdbcOdbcResultSet.java:1514)
	- locked <028237B0> (a sun.jdbc.odbc.JdbcOdbcResultSet)
	at sun.jdbc.odbc.JdbcOdbcResultSet.updateRow
(JdbcOdbcResultSet.java:4055)
	at Test2.tryUpdateBytes(Test2.java:68)
	at Test2.main(Test2.java:113)

Dynamic libraries:
0x7D6F0000 - 0x7D70D000 	C:\WINDOWS\SYSTEM\IMAGEHLP.DLL

Local Time = Mon Nov 12  customer :20:29 2001
Elapsed Time = 2
#
# The exception above was detected in native code outside the VM
#
# Java VM: Java HotSpot(TM) Client VM (1.4.0-beta3-b84 mixed mode)
#
# An error report file has been saved as hs_err_pid4294550101.log.
# Please refer to the file for further information.
#

If updating only one row instead two, then updateRow() isn't crashed JVM, but
do not updating database.
(Review ID: 135437) 
======================================================================
Work Around




using INSERT and UPDATE statements
======================================================================
Evaluation
This again is duplicate of bug 4486195. Please use merlin builds after b87 for getting the fix.


  xxxxx@xxxxx   2001-12-04
Comments
  
  Include a link with my name & email   


PLEASE NOTE: JDK6 is formerly known as Project Mustang