Bugs item #572281, was opened at 2002-06-21 15:46
Message generated for change (Comment added) made by dsundstrom
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=376685&aid=572281&group_id=22866

Category: JBossCMP
Group: v4.0
Status: Open
Resolution: Postponed
Priority: 5
Submitted By: Colin Li (colinl)
>Assigned to: Nobody/Anonymous (nobody)
Summary: oracle clob mapping problem

Initial Comment:
We had an entity bean with a cmp-field using a char
[] type to mapping CLOB type column in oracle 
database. This entity bean worked fine in 
Orion1.5.2. Now we are planning to port our 
application to Jboss3.0.0 and we have deployed one 
of our ear file including this bean in Jboss3.0.0 
(stable version). However, we got error messages in 
jboss console when we ran one of our test cases:

<<javax.ejb.EJBException: Internal error getting 
results for field member CLOB_DATA
Embedded Exception
Stream has already been closed
.......>>

CLOB_DATA is the char[] type cmp-field. 

We checked the standardjbosscmp-jdbc.xml and 
we did not find a clob type mapping in 
<type-mapping>
         <name>Oracle8</name>

So, is this a bug or not?

When will Jboss support Clob mapping?

Thanks a lot!


C:\jboss-3.0.0\bin>run
=================================
=================================
=============
.
  JBoss Bootstrap Environment
.
  JBOSS_HOME: C:\jboss-3.0.0\bin\..
.
  JAVA: C:\jdk1.3\bin\java
.
  JAVA_OPTS:  -Dprogram.name=run.bat
.
  CLASSPATH: ;C:\jdk1.3\lib\tools.jar;C:\jboss-
3.0.0\bin\run.jar
.
=================================
=================================
=============



----------------------------------------------------------------------

>Comment By: Dain Sundstrom (dsundstrom)
Date: 2003-08-17 17:40

Message:
Logged In: YES 
user_id=251431

I am no no longer a JBoss committer, so I am unable to fix
any bugs.

----------------------------------------------------------------------

Comment By: Colin Li (colinl)
Date: 2002-12-04 10:10

Message:
Logged In: YES 
user_id=566827

Thank you so much!  We'll try it again.

----------------------------------------------------------------------

Comment By: Stephen Coy (scoy)
Date: 2002-12-03 17:35

Message:
Logged In: YES 
user_id=463096

1. All bets are off if you are using code prior to 3.0.4.

2. The source you are looking at is pre-3.0.4 - it is quite different now.

3. Please show the <entity> fragment from your jbosscmp-jdbc.xml file.
If you don't have one, the code will fall thu and try to use 
PrepareStatement.setObject(), which is unlikely to work.
There are no standard Oracle mappings for char[] -> CLOB, although I 
guess we could add them.

Finally, please ensure that you are using the absolute latest Oracle 9.2 
JDBC drivers, even if your database is Oracle 8. Also, you must use the 
"OCI" variant if you want to store LOB's greater than about 4k.


----------------------------------------------------------------------

Comment By: Colin Li (colinl)
Date: 2002-12-03 11:02

Message:
Logged In: YES 
user_id=566827

We have tested with both oracle.LONG( 
jdbcType==Types.LONGVARCHAR ) and oracle.CLOB( 
jdbcType==Types.CLOB) for mapping large characters object 
but still failed in the Oracle problem with CLOBs > 2000 
characters(writing data). 

I tried to track the jdbcType in the utility class: 
org.jboss.ejb.plugins.cmp.jdbc.JDBCUtil.java (version: 1.13) 
and I noticed the method:
public static void setParameter(
         Logger log, 
         PreparedStatement ps, 
         int index, 
         int jdbcType, 
         Object value) throws SQLException{....}
always goes to: line 246-version:1.13
      //
      //  Standard SQL type
      //
      ps.setObject(index, value, jdbcType);
which always throw an exception when setting large 
characters(>2000) object. 

I added a try-catch block for this method:
      try {
        ps.setObject(index, value, jdbcType);
      } catch ( SQLException se ){
         log.error( "Index is: " + index );
         log.error( "JDBC Type of this field is: " + jdbcType );
         throw se;
      }

and then I got: 
     JDBC Type of this field is: 12. 
       ( This is java.sql.Types.VARCHAR )
for the column: 
     CLOB_DATA(oracle.LONG) and (oracle.CLOB).

but the java.sql.Types.LONGVARCHAR == -1 and 
java.sql.Types.CLOB == 2005. This means the code will 
never go to line 203:
     ps.setCharacterStream(index, reader, string.length());
at:
       if(jdbcType == Types.LONGVARCHAR || jdbcType == 
Types.CLOB) // I added jdbcType == Types.LONGVARCHAR 
      {
         String string = value.toString();
         StringReader reader = null;
         try {
            reader = new StringReader(string);
            ps.setCharacterStream(index, reader, string.length());
         } finally
         {
            safeClose(reader);
         }
         return;
      } 

We also tested in the latest version 1.14(10/23/02) in 
jboss3.0.4 and it still didn't work. We wrote a bmp bean for 
mapping the oracle.LONG and it works fine. 

I just don't know why the jdbcType for mapping a 
oracle.LONG or a oracle.CLOB in the code(JDBCUtil.java) is 
always java.sql.Types.VARCHAR.

Thanks. 

----------------------------------------------------------------------

Comment By: Stephen Coy (scoy)
Date: 2002-10-31 01:10

Message:
Logged In: YES 
user_id=463096

The handling of large character and binary columns has been completely 
overhauled.

I believe that this can be closed.


----------------------------------------------------------------------

Comment By: Dain Sundstrom (dsundstrom)
Date: 2002-06-27 13:27

Message:
Logged In: YES 
user_id=251431

This will be fixed when blob handling is rewritten.

----------------------------------------------------------------------

Comment By: Dain Sundstrom (dsundstrom)
Date: 2002-06-24 15:03

Message:
Logged In: YES 
user_id=251431

Oracle's drivers are non-compliant and suck overall.  One
day this will be fixed.  Several people have told me that
they we're goin to take a look at it, but no one fixed it yet.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=376685&aid=572281&group_id=22866


-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01
_______________________________________________
JBoss-Development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to