RE: [JBoss-dev] Oracle BLOB handling - FIXED?

2002-06-18 Thread Karl Koster

One of the problems we discovered with Oracle LOB types while using them in a 2-tier 
environment was that the LOB lengths were being recorded incorrectly. (even when using 
the Oracle specific LOB classes) As long as the LOB grew in length, there was no 
problem. As soon as you wrote back a LOB that was shorter than the prior instance, 
errors occurred. The way we got around this was to create a PL/SQL block like this: 

begin DBMS_LOB.TRIM(?, ?);DBMS_LOB.TRIM(?, ?); end;

That would be executed within the same DB transaction that housed the update.

Karl Koster
[EMAIL PROTECTED]
Sempra Energy Trading

-Original Message-
From: Dain Sundstrom [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, June 18, 2002 11:05 AM
To: [EMAIL PROTECTED]
Subject: Re: [JBoss-dev] Oracle BLOB handling - FIXED?


This is the way the code was before I integrated the Oracle BLOB patch.
The problem is the serialized stream is being truncated to 4000 bytes.

I just got an email from someone willing to work on implementing correct 
BLOB handling.

I'd still like someone to try this in Oracle 8.

-dain

Stephen Coy wrote:
> I've done some more  poking at this, and modified JDBCUtil.setParameter 
> as follows:
> 
>   //
>   // Binary types need to be converted to a byte array and set
>   //
>   if(isBinaryJDBCType(jdbcType))
>   {
>  byte[] bytes = convertObjectToByteArray(value);
> 
>  if (bytes.length < 2000 && jdbcType != Types.BLOB)
>  {
> // it's more efficient to use setBinaryStream for large
> // streams, and causes problems if not done on some DBMS
> // implementations
> ps.setBytes(index, bytes);
>  } else
>  {
> InputStream in = null;
> try
> {
>in = new ByteArrayInputStream(bytes);
>ps.setBinaryStream(index, in, bytes.length);
> } finally
> {
>safeClose(in);
> }
>  }
>  return;
> 
> ie. Forget about the ByteArrayBlob class.
> 
> This works fine when writing to the database.
> 
> However, reading the data back fails:
> 
> 2002-06-18 23:59:20,671 DEBUG 
> [org.jboss.ejb.plugins.cmp.jdbc.JDBCLoadEntityCommand.SimpleEJB] 
> Executing SQL: SELECT booleanPrimitive, booleanObject, bytePrimitive, 
> byteObject, shortPrimitive, shortObject, integerPrimitive, 
> integerObject, longPrimitive, longObject, floatPrimitive, floatObject, 
> doublePrimitive, doubleObject, stringValue, utilDateValue, sqlDateValue, 
> timeValue, timestampValue, bigDecimalValue, byteArrayValue, objectValue 
> FROM SIMPLE WHERE (id=?)
> 2002-06-18 23:59:20,680 TRACE 
> [org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMP2xFieldBridge.SimpleEJB.id] 
> Set parameter: index=1, jdbcType=VARCHAR, value=simple
> 2002-06-18 23:59:20,707 TRACE 
> 
>[org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMP2xFieldBridge.SimpleEJB.booleanPrimitive]
> 
> 
>  Get result: index=1, javaType=boolean, Simple, value=true
> 2002-06-18 23:59:20,709 TRACE 
> [org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMP2xFieldBridge.SimpleEJB.booleanObject] 
> 
>  Get result: index=2, javaType=java.lang.Boolean, Simple, value=false
> 2002-06-18 23:59:20,713 TRACE 
> [org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMP2xFieldBridge.SimpleEJB.bytePrimitive] 
> 
>  Get result: index=3, javaType=byte, Simple, value=11
> 2002-06-18 23:59:20,715 TRACE 
> [org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMP2xFieldBridge.SimpleEJB.byteObject] 
> 
>  Get result: index=4, javaType=java.lang.Byte, Simple, value=22
> 2002-06-18 23:59:20,717 TRACE 
> 
>[org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMP2xFieldBridge.SimpleEJB.shortPrimitive] 
> 
>  Get result: index=5, javaType=short, Simple, value=33
> 2002-06-18 23:59:20,718 TRACE 
> [org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMP2xFieldBridge.SimpleEJB.shortObject] 
> 
>  Get result: index=6, javaType=java.lang.Short, Simple, value=44
> 2002-06-18 23:59:20,720 TRACE 
> 
>[org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMP2xFieldBridge.SimpleEJB.integerPrimitive]
> 
> 
>  Get result: index=7, javaType=int, Simple, value=55
> 2002-06-18 23:59:20,726 TRACE 
> [org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMP2xFieldBridge.SimpleEJB.integerObject] 
> 
>  Get result: index=8, javaType=java.lang.Integer, Simple, value=66
> 2002-06-18 23:59:20,728 TRACE 
> [org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMP2xFieldBridge.SimpleEJB.longPrimitive] 
> 
>  Get result: index=9, javaType=long, Simple, value=77
> 2002-06-18 23:59:20,730 TRACE 
> [org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMP2xFieldBridge.SimpleEJB.longOb

Re: [JBoss-dev] Oracle BLOB handling - FIXED?

2002-06-18 Thread Brian Sondergaard

We've had nothing but headaches using the Oracle JDBC drivers. They don't
handle LOBs the way everyone else does, especially when the size is greater
than 4000. That's a specific cuttoff. Anything below that will behave the
way you'd expect. Anything over that will certainly fail unless you code
specifically to handle it (at least in our testing).

Here are a couple articles that may be useful:

http://otn.oracle.com/doc/java.815/a64685/oraext4.htm#1043351

http://technet.oracle.com/sample_code/tech/java/sqlj_jdbc/files/jdbc20/LOBSa
mple/LOBSample.java.html

Hope this is helpful.

Brian

- Original Message -
From: "Dain Sundstrom" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, June 18, 2002 11:04 AM
Subject: Re: [JBoss-dev] Oracle BLOB handling - FIXED?


> This is the way the code was before I integrated the Oracle BLOB patch.
> The problem is the serialized stream is being truncated to 4000 bytes.
>
> I just got an email from someone willing to work on implementing correct
> BLOB handling.
>
> I'd still like someone to try this in Oracle 8.
>
> -dain
>
> Stephen Coy wrote:
> > I've done some more  poking at this, and modified JDBCUtil.setParameter
> > as follows:
> >
> >   //
> >   // Binary types need to be converted to a byte array and set
> >   //
> >   if(isBinaryJDBCType(jdbcType))
> >   {
> >  byte[] bytes = convertObjectToByteArray(value);
> >
> >  if (bytes.length < 2000 && jdbcType != Types.BLOB)
> >  {
> > // it's more efficient to use setBinaryStream for large
> > // streams, and causes problems if not done on some DBMS
> > // implementations
> > ps.setBytes(index, bytes);
> >  } else
> >  {
> > InputStream in = null;
> > try
> > {
> >in = new ByteArrayInputStream(bytes);
> >ps.setBinaryStream(index, in, bytes.length);
> > } finally
> > {
> >safeClose(in);
> > }
> >  }
> >  return;
> >
> > ie. Forget about the ByteArrayBlob class.
> >
> > This works fine when writing to the database.
> >
> > However, reading the data back fails:
> >
> > 2002-06-18 23:59:20,671 DEBUG
> > [org.jboss.ejb.plugins.cmp.jdbc.JDBCLoadEntityCommand.SimpleEJB]
> > Executing SQL: SELECT booleanPrimitive, booleanObject, bytePrimitive,
> > byteObject, shortPrimitive, shortObject, integerPrimitive,
> > integerObject, longPrimitive, longObject, floatPrimitive, floatObject,
> > doublePrimitive, doubleObject, stringValue, utilDateValue, sqlDateValue,
> > timeValue, timestampValue, bigDecimalValue, byteArrayValue, objectValue
> > FROM SIMPLE WHERE (id=?)
> > 2002-06-18 23:59:20,680 TRACE
> >
[org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMP2xFieldBridge.SimpleEJB.id]
> > Set parameter: index=1, jdbcType=VARCHAR, value=simple
> > 2002-06-18 23:59:20,707 TRACE
> >
[org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMP2xFieldBridge.SimpleEJB.boolea
nPrimitive]
> >
> >  Get result: index=1, javaType=boolean, Simple, value=true
> > 2002-06-18 23:59:20,709 TRACE
> >
[org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMP2xFieldBridge.SimpleEJB.boolea
nObject]
> >
> >  Get result: index=2, javaType=java.lang.Boolean, Simple, value=false
> > 2002-06-18 23:59:20,713 TRACE
> >
[org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMP2xFieldBridge.SimpleEJB.bytePr
imitive]
> >
> >  Get result: index=3, javaType=byte, Simple, value=11
> > 2002-06-18 23:59:20,715 TRACE
> >
[org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMP2xFieldBridge.SimpleEJB.byteOb
ject]
> >
> >  Get result: index=4, javaType=java.lang.Byte, Simple, value=22
> > 2002-06-18 23:59:20,717 TRACE
> >
[org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMP2xFieldBridge.SimpleEJB.shortP
rimitive]
> >
> >  Get result: index=5, javaType=short, Simple, value=33
> > 2002-06-18 23:59:20,718 TRACE
> >
[org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMP2xFieldBridge.SimpleEJB.shortO
bject]
> >
> >  Get result: index=6, javaType=java.lang.Short, Simple, value=44
> > 2002-06-18 23:59:20,720 TRACE
> >
[org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMP2xFieldBridge.SimpleEJB.intege
rPrimitive]
> >
> >  Get result: index=7, javaType=int, Simple, value=55
> > 2002-06-18 23:59:20,726 TRACE
> >
[org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMP2xFieldBridge.SimpleEJB.intege
rObject]
> >
> >  Get result: index=8, java

Re: [JBoss-dev] Oracle BLOB handling - FIXED?

2002-06-18 Thread Dain Sundstrom

This is the way the code was before I integrated the Oracle BLOB patch.
The problem is the serialized stream is being truncated to 4000 bytes.

I just got an email from someone willing to work on implementing correct 
BLOB handling.

I'd still like someone to try this in Oracle 8.

-dain

Stephen Coy wrote:
> I've done some more  poking at this, and modified JDBCUtil.setParameter 
> as follows:
> 
>   //
>   // Binary types need to be converted to a byte array and set
>   //
>   if(isBinaryJDBCType(jdbcType))
>   {
>  byte[] bytes = convertObjectToByteArray(value);
> 
>  if (bytes.length < 2000 && jdbcType != Types.BLOB)
>  {
> // it's more efficient to use setBinaryStream for large
> // streams, and causes problems if not done on some DBMS
> // implementations
> ps.setBytes(index, bytes);
>  } else
>  {
> InputStream in = null;
> try
> {
>in = new ByteArrayInputStream(bytes);
>ps.setBinaryStream(index, in, bytes.length);
> } finally
> {
>safeClose(in);
> }
>  }
>  return;
> 
> ie. Forget about the ByteArrayBlob class.
> 
> This works fine when writing to the database.
> 
> However, reading the data back fails:
> 
> 2002-06-18 23:59:20,671 DEBUG 
> [org.jboss.ejb.plugins.cmp.jdbc.JDBCLoadEntityCommand.SimpleEJB] 
> Executing SQL: SELECT booleanPrimitive, booleanObject, bytePrimitive, 
> byteObject, shortPrimitive, shortObject, integerPrimitive, 
> integerObject, longPrimitive, longObject, floatPrimitive, floatObject, 
> doublePrimitive, doubleObject, stringValue, utilDateValue, sqlDateValue, 
> timeValue, timestampValue, bigDecimalValue, byteArrayValue, objectValue 
> FROM SIMPLE WHERE (id=?)
> 2002-06-18 23:59:20,680 TRACE 
> [org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMP2xFieldBridge.SimpleEJB.id] 
> Set parameter: index=1, jdbcType=VARCHAR, value=simple
> 2002-06-18 23:59:20,707 TRACE 
> 
>[org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMP2xFieldBridge.SimpleEJB.booleanPrimitive]
> 
> 
>  Get result: index=1, javaType=boolean, Simple, value=true
> 2002-06-18 23:59:20,709 TRACE 
> [org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMP2xFieldBridge.SimpleEJB.booleanObject] 
> 
>  Get result: index=2, javaType=java.lang.Boolean, Simple, value=false
> 2002-06-18 23:59:20,713 TRACE 
> [org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMP2xFieldBridge.SimpleEJB.bytePrimitive] 
> 
>  Get result: index=3, javaType=byte, Simple, value=11
> 2002-06-18 23:59:20,715 TRACE 
> [org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMP2xFieldBridge.SimpleEJB.byteObject] 
> 
>  Get result: index=4, javaType=java.lang.Byte, Simple, value=22
> 2002-06-18 23:59:20,717 TRACE 
> 
>[org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMP2xFieldBridge.SimpleEJB.shortPrimitive] 
> 
>  Get result: index=5, javaType=short, Simple, value=33
> 2002-06-18 23:59:20,718 TRACE 
> [org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMP2xFieldBridge.SimpleEJB.shortObject] 
> 
>  Get result: index=6, javaType=java.lang.Short, Simple, value=44
> 2002-06-18 23:59:20,720 TRACE 
> 
>[org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMP2xFieldBridge.SimpleEJB.integerPrimitive]
> 
> 
>  Get result: index=7, javaType=int, Simple, value=55
> 2002-06-18 23:59:20,726 TRACE 
> [org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMP2xFieldBridge.SimpleEJB.integerObject] 
> 
>  Get result: index=8, javaType=java.lang.Integer, Simple, value=66
> 2002-06-18 23:59:20,728 TRACE 
> [org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMP2xFieldBridge.SimpleEJB.longPrimitive] 
> 
>  Get result: index=9, javaType=long, Simple, value=77
> 2002-06-18 23:59:20,730 TRACE 
> [org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMP2xFieldBridge.SimpleEJB.longObject] 
> 
>  Get result: index=10, javaType=java.lang.Long, Simple, value=88
> 2002-06-18 23:59:20,731 TRACE 
> 
>[org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMP2xFieldBridge.SimpleEJB.floatPrimitive] 
> 
>  Get result: index=11, javaType=float, Simple, value=11.11
> 2002-06-18 23:59:20,733 TRACE 
> [org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMP2xFieldBridge.SimpleEJB.floatObject] 
> 
>  Get result: index=12, javaType=java.lang.Float, Simple, value=22.22
> 2002-06-18 23:59:20,735 TRACE 
> 
>[org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMP2xFieldBridge.SimpleEJB.doublePrimitive]
> 
> 
>  Get result: index=13, javaType=double, Simple, value=33.33
> 2002-06-18 23:59:20,738 TRACE 
> [org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMP2xFieldBridge.SimpleEJB.doubleObject] 
> 
>  Get result: index=14, javaType=java.lang.Double, Simple, value=44.44
> 2002-06-18 23:59:20,740 TRACE 
> [org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMP2xFieldBridge.SimpleEJB.stringValue] 
> 
>  Get result: index=15, javaType=java.lang.String, Simple, value=test 
> string value
> 2002-06-18 23:59:20,742 TRACE 
> [org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMP2xFieldBridge.SimpleEJB.utilDateVa

Re: [JBoss-dev] Oracle BLOB handling - FIXED?

2002-06-18 Thread Stephen Coy

I've done some more  poking at this, and modified JDBCUtil.setParameter 
as follows:

   //
   // Binary types need to be converted to a byte array and set
   //
   if(isBinaryJDBCType(jdbcType))
   {
  byte[] bytes = convertObjectToByteArray(value);

  if (bytes.length < 2000 && jdbcType != Types.BLOB)
  {
 // it's more efficient to use setBinaryStream for large
 // streams, and causes problems if not done on some DBMS
 // implementations
 ps.setBytes(index, bytes);
  } else
  {
 InputStream in = null;
 try
 {
in = new ByteArrayInputStream(bytes);
ps.setBinaryStream(index, in, bytes.length);
 } finally
 {
safeClose(in);
 }
  }
  return;

ie. Forget about the ByteArrayBlob class.

This works fine when writing to the database.

However, reading the data back fails:

2002-06-18 23:59:20,671 DEBUG 
[org.jboss.ejb.plugins.cmp.jdbc.JDBCLoadEntityCommand.SimpleEJB] 
Executing SQL: SELECT booleanPrimitive, booleanObject, bytePrimitive, 
byteObject, shortPrimitive, shortObject, integerPrimitive, 
integerObject, longPrimitive, longObject, floatPrimitive, floatObject, 
doublePrimitive, doubleObject, stringValue, utilDateValue, sqlDateValue, 
timeValue, timestampValue, bigDecimalValue, byteArrayValue, objectValue 
FROM SIMPLE WHERE (id=?)
2002-06-18 23:59:20,680 TRACE 
[org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMP2xFieldBridge.SimpleEJB.id] 
Set parameter: index=1, jdbcType=VARCHAR, value=simple
2002-06-18 23:59:20,707 TRACE 
[org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMP2xFieldBridge.SimpleEJB.booleanPrimitive]
  Get result: index=1, javaType=boolean, Simple, value=true
2002-06-18 23:59:20,709 TRACE 
[org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMP2xFieldBridge.SimpleEJB.booleanObject]
  Get result: index=2, javaType=java.lang.Boolean, Simple, value=false
2002-06-18 23:59:20,713 TRACE 
[org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMP2xFieldBridge.SimpleEJB.bytePrimitive]
  Get result: index=3, javaType=byte, Simple, value=11
2002-06-18 23:59:20,715 TRACE 
[org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMP2xFieldBridge.SimpleEJB.byteObject]
  Get result: index=4, javaType=java.lang.Byte, Simple, value=22
2002-06-18 23:59:20,717 TRACE 
[org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMP2xFieldBridge.SimpleEJB.shortPrimitive]
  Get result: index=5, javaType=short, Simple, value=33
2002-06-18 23:59:20,718 TRACE 
[org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMP2xFieldBridge.SimpleEJB.shortObject]
  Get result: index=6, javaType=java.lang.Short, Simple, value=44
2002-06-18 23:59:20,720 TRACE 
[org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMP2xFieldBridge.SimpleEJB.integerPrimitive]
  Get result: index=7, javaType=int, Simple, value=55
2002-06-18 23:59:20,726 TRACE 
[org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMP2xFieldBridge.SimpleEJB.integerObject]
  Get result: index=8, javaType=java.lang.Integer, Simple, value=66
2002-06-18 23:59:20,728 TRACE 
[org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMP2xFieldBridge.SimpleEJB.longPrimitive]
  Get result: index=9, javaType=long, Simple, value=77
2002-06-18 23:59:20,730 TRACE 
[org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMP2xFieldBridge.SimpleEJB.longObject]
  Get result: index=10, javaType=java.lang.Long, Simple, value=88
2002-06-18 23:59:20,731 TRACE 
[org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMP2xFieldBridge.SimpleEJB.floatPrimitive]
  Get result: index=11, javaType=float, Simple, value=11.11
2002-06-18 23:59:20,733 TRACE 
[org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMP2xFieldBridge.SimpleEJB.floatObject]
  Get result: index=12, javaType=java.lang.Float, Simple, value=22.22
2002-06-18 23:59:20,735 TRACE 
[org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMP2xFieldBridge.SimpleEJB.doublePrimitive]
  Get result: index=13, javaType=double, Simple, value=33.33
2002-06-18 23:59:20,738 TRACE 
[org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMP2xFieldBridge.SimpleEJB.doubleObject]
  Get result: index=14, javaType=java.lang.Double, Simple, value=44.44
2002-06-18 23:59:20,740 TRACE 
[org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMP2xFieldBridge.SimpleEJB.stringValue]
  Get result: index=15, javaType=java.lang.String, Simple, value=test 
string value
2002-06-18 23:59:20,742 TRACE 
[org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMP2xFieldBridge.SimpleEJB.utilDateValue]
  Get result: index=16, javaType=java.util.Date, Simple, value=1970-01-01 
11:00:01.111
2002-06-18 23:59:20,744 TRACE 
[org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMP2xFieldBridge.SimpleEJB.sqlDateValue]
  Get result: index=17, javaType=java.sql.Date, Simple, value=1981-05-05
2002-06-18 23:59:20,746 TRACE 
[org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMP2xFieldBridge.SimpleEJB.timeValue]
  Get result: index=18, javaType=java.sql.Time, Simple, value=22:33:44
2002-06-18 23:59:20,748 TRACE 
[org.jboss.ejb.plugins.cmp.jdbc.bridge.J

Re: [JBoss-dev] Oracle BLOB handling - FIXED?

2002-06-18 Thread Dain Sundstrom

Crap.  I bet the check for a specific Oracle type in the new drivers.

I'll switch it back to JAVA_OBJECT for 9i.  Can someone please test 
Oracle 8?   If it doesn't work with either one, I'm going to delete the 
new code.

Does anyone want to work on the real fix for this?  I can walk you 
through what needs to be changed.

-dain

Stephen Coy wrote:
> Initial testing in Oracle 9i was not promising (using the latest driver 
> (Oracle JDBC Driver version - 9.0.2.0.0):
> 
> 2002-06-18 23:39:05,843 DEBUG 
> [org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreEntityCommand.SimpleEJB] 
> Executing SQL: UPDATE SIMPLE SET booleanPrimitive=?, booleanObject=?, 
> bytePrimitive=?, byteObject=?, shortPrimitive=?, shortObject=?, 
> integerPrimitive=?, integerObject=?, longPrimitive=?, longObject=?, 
> floatPrimitive=?, floatObject=?, doublePrimitive=?, doubleObject=?, 
> stringValue=?, utilDateValue=?, sqlDateValue=?, timeValue=?, 
> timestampValue=?, bigDecimalValue=?, byteArrayValue=?, objectValue=? 
> WHERE id=?
> 2002-06-18 23:39:05,848 TRACE 
> 
>[org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMP2xFieldBridge.SimpleEJB.booleanPrimitive]
> 
> 
>  Set parameter: index=1, jdbcType=BIT, value=true
> 2002-06-18 23:39:05,849 TRACE 
> [org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMP2xFieldBridge.SimpleEJB.booleanObject] 
> 
>  Set parameter: index=2, jdbcType=BIT, value=false
> 2002-06-18 23:39:05,849 TRACE 
> [org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMP2xFieldBridge.SimpleEJB.bytePrimitive] 
> 
>  Set parameter: index=3, jdbcType=TINYINT, value=11
> 2002-06-18 23:39:05,849 TRACE 
> [org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMP2xFieldBridge.SimpleEJB.byteObject] 
> 
>  Set parameter: index=4, jdbcType=TINYINT, value=22
> 2002-06-18 23:39:05,849 TRACE 
> 
>[org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMP2xFieldBridge.SimpleEJB.shortPrimitive] 
> 
>  Set parameter: index=5, jdbcType=SMALLINT, value=33
> 2002-06-18 23:39:05,850 TRACE 
> [org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMP2xFieldBridge.SimpleEJB.shortObject] 
> 
>  Set parameter: index=6, jdbcType=SMALLINT, value=44
> 2002-06-18 23:39:05,850 TRACE 
> 
>[org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMP2xFieldBridge.SimpleEJB.integerPrimitive]
> 
> 
>  Set parameter: index=7, jdbcType=INTEGER, value=55
> 2002-06-18 23:39:05,850 TRACE 
> [org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMP2xFieldBridge.SimpleEJB.integerObject] 
> 
>  Set parameter: index=8, jdbcType=INTEGER, value=66
> 2002-06-18 23:39:05,850 TRACE 
> [org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMP2xFieldBridge.SimpleEJB.longPrimitive] 
> 
>  Set parameter: index=9, jdbcType=BIGINT, value=77
> 2002-06-18 23:39:05,851 TRACE 
> [org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMP2xFieldBridge.SimpleEJB.longObject] 
> 
>  Set parameter: index=10, jdbcType=BIGINT, value=88
> 2002-06-18 23:39:05,851 TRACE 
> 
>[org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMP2xFieldBridge.SimpleEJB.floatPrimitive] 
> 
>  Set parameter: index=11, jdbcType=REAL, value=11.11
> 2002-06-18 23:39:05,851 TRACE 
> [org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMP2xFieldBridge.SimpleEJB.floatObject] 
> 
>  Set parameter: index=12, jdbcType=REAL, value=22.22
> 2002-06-18 23:39:05,855 TRACE 
> 
>[org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMP2xFieldBridge.SimpleEJB.doublePrimitive]
> 
> 
>  Set parameter: index=13, jdbcType=DOUBLE, value=33.33
> 2002-06-18 23:39:05,855 TRACE 
> [org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMP2xFieldBridge.SimpleEJB.doubleObject] 
> 
>  Set parameter: index=14, jdbcType=DOUBLE, value=44.44
> 2002-06-18 23:39:05,855 TRACE 
> [org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMP2xFieldBridge.SimpleEJB.stringValue] 
> 
>  Set parameter: index=15, jdbcType=VARCHAR, value=test string value
> 2002-06-18 23:39:05,856 TRACE 
> [org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMP2xFieldBridge.SimpleEJB.utilDateValue] 
> 
>  Set parameter: index=16, jdbcType=TIMESTAMP, value=Thu Jan 01 11:00:01 
> EST 1970
> 2002-06-18 23:39:05,856 TRACE 
> [org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMP2xFieldBridge.SimpleEJB.sqlDateValue] 
> 
>  Set parameter: index=17, jdbcType=DATE, value=1981-05-05
> 2002-06-18 23:39:05,857 TRACE 
> [org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMP2xFieldBridge.SimpleEJB.timeValue] 
> 
>  Set parameter: index=18, jdbcType=TIME, value=22:33:44
> 2002-06-18 23:39:05,858 TRACE 
> 
>[org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMP2xFieldBridge.SimpleEJB.timestampValue] 
> 
>  Set parameter: index=19, jdbcType=TIMESTAMP, value=1970-01-01 11:00:04.444
> 2002-06-18 23:39:05,858 TRACE 
> 
>[org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMP2xFieldBridge.SimpleEJB.bigDecimalValue]
> 
> 
>  Set parameter: index=20, jdbcType=DECIMAL, value=12345678
> 2002-06-18 23:39:05,859 TRACE 
> 
>[org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMP2xFieldBridge.SimpleEJB.byteArrayValue] 
> 
>  Set parameter: index=21, jdbcType=BLOB, value=[B@2d54c5
> 2002-06-18 23:39:05,861 ERROR [org.jboss.ejb.GlobalTxEntityMap] Store 
> failed on entity: simple
> javax.ejb.EJBException: Store 

Re: [JBoss-dev] Oracle BLOB handling - FIXED?

2002-06-18 Thread Stephen Coy

Initial testing in Oracle 9i was not promising (using the latest driver 
(Oracle JDBC Driver version - 9.0.2.0.0):

2002-06-18 23:39:05,843 DEBUG 
[org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreEntityCommand.SimpleEJB] 
Executing SQL: UPDATE SIMPLE SET booleanPrimitive=?, booleanObject=?, 
bytePrimitive=?, byteObject=?, shortPrimitive=?, shortObject=?, 
integerPrimitive=?, integerObject=?, longPrimitive=?, longObject=?, 
floatPrimitive=?, floatObject=?, doublePrimitive=?, doubleObject=?, 
stringValue=?, utilDateValue=?, sqlDateValue=?, timeValue=?, 
timestampValue=?, bigDecimalValue=?, byteArrayValue=?, objectValue=? 
WHERE id=?
2002-06-18 23:39:05,848 TRACE 
[org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMP2xFieldBridge.SimpleEJB.booleanPrimitive]
  Set parameter: index=1, jdbcType=BIT, value=true
2002-06-18 23:39:05,849 TRACE 
[org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMP2xFieldBridge.SimpleEJB.booleanObject]
  Set parameter: index=2, jdbcType=BIT, value=false
2002-06-18 23:39:05,849 TRACE 
[org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMP2xFieldBridge.SimpleEJB.bytePrimitive]
  Set parameter: index=3, jdbcType=TINYINT, value=11
2002-06-18 23:39:05,849 TRACE 
[org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMP2xFieldBridge.SimpleEJB.byteObject]
  Set parameter: index=4, jdbcType=TINYINT, value=22
2002-06-18 23:39:05,849 TRACE 
[org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMP2xFieldBridge.SimpleEJB.shortPrimitive]
  Set parameter: index=5, jdbcType=SMALLINT, value=33
2002-06-18 23:39:05,850 TRACE 
[org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMP2xFieldBridge.SimpleEJB.shortObject]
  Set parameter: index=6, jdbcType=SMALLINT, value=44
2002-06-18 23:39:05,850 TRACE 
[org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMP2xFieldBridge.SimpleEJB.integerPrimitive]
  Set parameter: index=7, jdbcType=INTEGER, value=55
2002-06-18 23:39:05,850 TRACE 
[org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMP2xFieldBridge.SimpleEJB.integerObject]
  Set parameter: index=8, jdbcType=INTEGER, value=66
2002-06-18 23:39:05,850 TRACE 
[org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMP2xFieldBridge.SimpleEJB.longPrimitive]
  Set parameter: index=9, jdbcType=BIGINT, value=77
2002-06-18 23:39:05,851 TRACE 
[org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMP2xFieldBridge.SimpleEJB.longObject]
  Set parameter: index=10, jdbcType=BIGINT, value=88
2002-06-18 23:39:05,851 TRACE 
[org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMP2xFieldBridge.SimpleEJB.floatPrimitive]
  Set parameter: index=11, jdbcType=REAL, value=11.11
2002-06-18 23:39:05,851 TRACE 
[org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMP2xFieldBridge.SimpleEJB.floatObject]
  Set parameter: index=12, jdbcType=REAL, value=22.22
2002-06-18 23:39:05,855 TRACE 
[org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMP2xFieldBridge.SimpleEJB.doublePrimitive]
  Set parameter: index=13, jdbcType=DOUBLE, value=33.33
2002-06-18 23:39:05,855 TRACE 
[org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMP2xFieldBridge.SimpleEJB.doubleObject]
  Set parameter: index=14, jdbcType=DOUBLE, value=44.44
2002-06-18 23:39:05,855 TRACE 
[org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMP2xFieldBridge.SimpleEJB.stringValue]
  Set parameter: index=15, jdbcType=VARCHAR, value=test string value
2002-06-18 23:39:05,856 TRACE 
[org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMP2xFieldBridge.SimpleEJB.utilDateValue]
  Set parameter: index=16, jdbcType=TIMESTAMP, value=Thu Jan 01 11:00:01 
EST 1970
2002-06-18 23:39:05,856 TRACE 
[org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMP2xFieldBridge.SimpleEJB.sqlDateValue]
  Set parameter: index=17, jdbcType=DATE, value=1981-05-05
2002-06-18 23:39:05,857 TRACE 
[org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMP2xFieldBridge.SimpleEJB.timeValue]
  Set parameter: index=18, jdbcType=TIME, value=22:33:44
2002-06-18 23:39:05,858 TRACE 
[org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMP2xFieldBridge.SimpleEJB.timestampValue]
  Set parameter: index=19, jdbcType=TIMESTAMP, value=1970-01-01 
11:00:04.444
2002-06-18 23:39:05,858 TRACE 
[org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMP2xFieldBridge.SimpleEJB.bigDecimalValue]
  Set parameter: index=20, jdbcType=DECIMAL, value=12345678
2002-06-18 23:39:05,859 TRACE 
[org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMP2xFieldBridge.SimpleEJB.byteArrayValue]
  Set parameter: index=21, jdbcType=BLOB, value=[B@2d54c5
2002-06-18 23:39:05,861 ERROR [org.jboss.ejb.GlobalTxEntityMap] Store 
failed on entity: simple
javax.ejb.EJBException: Store failed; CausedByException is:
org.jboss.ejb.plugins.cmp.jdbc.ByteArrayBlob
at 
org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreEntityCommand.execute
(JDBCStoreEntityCommand.java:94)
at 
org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.storeEntity
(JDBCStoreManager.java:586)
at 
org.jboss.ejb.plugins.CMPPersistenceManager.storeEntity
(CMPPersistenceManager.java:458)
at 
org.jboss.resource.connectionmanager.CachedConnectionInterceptor.storeEntity(
CachedConnectionInterceptor.java:388)
at org.jboss.ejb.EntityContainer.storeEntity(EntityContainer.java:698)

[JBoss-dev] Oracle BLOB handling - FIXED?

2002-06-15 Thread Dain Sundstrom

I just committed the code from patch [ 525663 ] CMP and oracle blobs. 
Can some with Oracle check if the code actually works?

The following command will execute a new test I added which has a field 
of every type:

./build.sh -Dtest=org.jboss.test.cmp2.simple.SimpleUnitTestCase one-test

You'll need to change the datasource and datasource-mapping in the
src/resources/cmp2/simple/META-INF/jbosscmp-jdbc.xml file.

This won't work perfectly for every database vendor, because some 
vendor's don't support millisecond precise time and nanosecond precise 
timestamp values.  The test that is important for blobs is testObjectValue.

-dain


___

Sponsored by:
ThinkGeek at http://www.ThinkGeek.com/
___
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development