Problem of using WebRowSet
- From: "penny" <pengqiong2000@xxxxxxxxx>
- Date: 22 Apr 2005 02:21:46 -0700
Hi, everyone!
I've got a problem when I use WebRowSet to generate xml file from a
resultset that include blob column.
I find in fact you can't get the correct value as you want(binary data
encoded with Base64 encoding),because the implementation of WebRowSet
is not do this. We can find this by decompile
com.sun.rowset.internal.WebRowSetXmlWriter.class, this class output
xml, in writeValue()method we can find code:
private void writeValue(int i, RowSet rowset)
throws IOException
{
try
{
int j = rowset.getMetaData().getColumnType(i);
switch(j)
{
....
case -4:
case -3:
case -2:
break;
case -1:
case 1: // '\001'
case 12: // '\f'
writeStringData(rowset.getString(i));
break;
default:
.....
break;
}
}
catch(SQLException sqlexception)
{
.....
}
}
-2,-3,-4 are sql Types defined in java.sql.SqlTypes
public final static int BINARY = -2;
public final static int VARBINARY = -3;
public final static int LONGVARBINARY = -4;
a blob column often mapping to LONGVARBINARY so it will be break out
directly. I.e. write out nothing.
So xml file would be like:
meta:
<column-definition>
<column-index>1</column-index>
<auto-increment>false</auto-increment>
<case-sensitive>true</case-sensitive>
<currency>false</currency>
<nullable>1</nullable>
<signed>false</signed>
<searchable>true</searchable>
<column-display-size>16777215</column-display-size>
<column-label>blobfield</column-label>
<column-name>blobfield</column-name>
<schema-name></schema-name>
<column-precision>0</column-precision>
<column-scale>0</column-scale>
<table-name>tbl1220_in</table-name>
<catalog-name>test1</catalog-name>
<column-type>-4</column-type>
<column-type-name>BLOB</column-type-name>
</column-definition>
data:
<columnValue></columnValue>
Is there anybody use WebRowSet output binary data columns? And How
shall I do it?
.
- Prev by Date: Good JDO tutorial ?
- Next by Date: Re: How to find my data sources in a dynamic way
- Previous by thread: Good JDO tutorial ?
- Next by thread: Using apache/axis within Oracle
- Index(es):