Looking at the JConnect does:
Warning! The TextPointer class has been deprecated; that is, it is no longer recommended and may cease to exist in a future version of jConnect.
If your data server is Adaptive Server version 12.5 or later or Adaptive Server Anywhere version 6.0 or later, use the standard JDBC form to send image data:
PreparedStatement.setBinaryStream(int paramIndex,  InputStream image)


Seems to me that you could use an InputStream to read and write the data and define within iBatis a customer row handler to accommodate your needs.


Chris Mathrusse
[EMAIL PROTECTED]
Sybase, Inc
One Sybase Drive
Dublin, CA 94568
(925) 236-5553



"Balaji" <[EMAIL PROTECTED]>

03/24/2006 11:33 AM

Please respond to
[email protected]

To
<[email protected]>
cc
Subject
Re: Sybase JConnect 5.5 & CLOB





Chris,
 
Based on the Info on jconnect at this link http://www.sybase.com/detail?id=1009774   under  JDBC 2.0 Standard Methods Implementation topic getClob, getBlob etc have not been implemented.
 
What is the alternate datatype in Sybase 12.0, other than Text datatype that could used to hold large amount of text?
 
here is a link to discussion on the same subject on sybase.public.Jconnect.
http://groups.google.com/group/sybase.public.jconnect/browse_thread/thread/5a7853514d297d86/9712446c173217f5?hl=en#9712446c173217f5
 
Balaji
----- Original Message -----
From: [EMAIL PROTECTED]
To: [email protected]
Sent: Friday, March 24, 2006 12:54 PM
Subject: Re: Sybase JConnect 5.5 & CLOB


I know for a fact that when working with Oracle 9i I ran into problems when trying to use CLOB for storing my XML documents. Because of that I decided to use LONG RAW as the datatype on the table. I would stream the results out of the table into a byte[].  This also allowed me to specify the encoding for the field and prevented any loss of data.


I don't know if you have the ability to change the datatype but you may want to consider it an option. You also may want to upgrade you JConnect driver to version 6.0 as well as run the update for the metadata.  This will ensure that you have the latest code that addresses many issues.


Other than that you may want to post a message pertaining to this on the sybase.public.jconnect newsgroup to see if there is anyone that may have experience with this.

Chris Mathrusse
[EMAIL PROTECTED]
Sybase, Inc
One Sybase Drive
Dublin, CA 94568
(925) 236-5553


"Balaji" <[EMAIL PROTECTED]>

03/24/2006 10:35 AM

Please respond to
[email protected]


To
<[email protected]>
cc
Subject
Re: Sybase JConnect 5.5 & CLOB







 

I looked at an Oracle example
http://opensource2.atlassian.com/confluence/oss/display/IBATIS/How+do+I+use+a+BLOB+or+CLOB
 

Looks like it is not supported and does not work if using Jconnect/Sybase

 

Does anyone have a working example(s) for sybase&Jconnect reading/writing Text datatype fields?

Also is sybase Text datatype mapping to CLOB JDBCType is correct or not?

 

Thanks,

 

Balaji

----- Original Message -----
From:
[EMAIL PROTECTED]
To:
[email protected]
Sent:
Wednesday, March 22, 2006 4:50 PM
Subject:
Re: Sybase JConnect 5.5 & CLOB


I think your problem is that you need to tell iBatis the column type that you are fetching. This is from a previous email in the archive.


iBATIS can fetch the BLOB as a stream of bytes. One way of doing what you
want is to create get/setters using byte[] that store/read to/from a private
String field, ie:

public class MyBean implements Serializable{

private String myString;

public void setStringAsByteArray(byte[] b) {
              myString = String(b);
}
public byte[] getStringAsByteArray() {
              return myString.getBytes();
}

public void setMyString(String s) {
              myString = s;
}
public String getMyString() {
              return myString;
}
}

and your result map:

<resultMap class="MyBean" id="MyBeanResultMap">
<result column="BLOB_COLUMN" property="stringAsByteArray" jdbcType="BLOB"/>
</resultMap>

That way you also have the chance to set the appropriate encoding to
your string.




Chris Mathrusse
[EMAIL PROTECTED]
Sybase, Inc
One Sybase Drive
Dublin, CA 94568
(925) 236-5553

"Balaji" <[EMAIL PROTECTED]>

03/22/2006 02:41 PM

Please respond to
[email protected]


To
<[email protected]>
cc
Subject
Re: Sybase JConnect 5.5 & CLOB









Chris,


now i am getting

Cause: java.sql.SQLException: JZ0TE: Attempted conversion between an illegal pair of types. Valid database datatypes are: 'varbinay, long binary, binary, image


Where should i be changing the datatype in POJO or resultMap?


here is the code (msg field is defined as Text datatype in db).  

public class Email  {  
private String from_addr;
private String to_addr;
private String subject;

 
//private String msg;
private byte[] msg;

public byte[] getMsg() {
return msg;
}

public void setMsg(byte[] bs) {
msg = bs;
}

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

<resultMap class="Email" id="EmailResult">
     <result column="from_addr" property="from_addr" />
     <result column="to_addr" property="to_addr" />
     <result column="subject" property="subject" />
     <result column="msg" property="msg" jdbcType="CLOB" />
</resultMap>


<select id="getEmailById" parameterClass="int" resultMap="EmailResult">
     SELECT  from_addr, to_addr, subject, msg
     FROM    email_store
     WHERE   id_email = #VALUE#
</select>

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


Thanks


Balaji

----- Original Message -----
From:
[EMAIL PROTECTED]
To:
[email protected]
Sent:
Wednesday, March 22, 2006 4:18 PM
Subject:
Re: Sybase JConnect 5.5 & CLOB



You should be reading the CLOB out of the database into a byte[] rather than a String. From there you can convert it into a String and apply any encoding that might be necessary.


Chris Mathrusse

[EMAIL PROTECTED]
Sybase, Inc
One Sybase Drive
Dublin, CA 94568
(925) 236-5553
"Balaji" <[EMAIL PROTECTED]>

03/22/2006 02:15 PM

Please respond to
[email protected]


To
<[email protected]>
cc
Subject
Sybase JConnect 5.5 & CLOB











When i try to read a 'TEXT' datatype field from Sybase 12.0 database &
JConnect 5.5,
- datatype in POJO is String  (also tried java.sql.Clob)
- jdbcType in resultMap is 'CLOB'

i get the following error message shown below.  Looks like getClob(string)
is not implemented in Jconnect yet.

Does anyone know how to get this to work, any workaround?

Thanks
Balaji

/***************************************************************************
*********************/
    ERROR MESSAGE
/***************************************************************************
*********************/
Caused by:
java.lang.UnsupportedOperationException: The method
com.sybase.jdbc2.jdbc.SybResultSet.getClob(String) is not supported and
should not be called.
at
com.sybase.jdbc2.jdbc.ErrorMessage.raiseRuntimeException(ErrorMessage.java:7
63)
at com.sybase.jdbc2.utils.Debug.notSupported(Debug.java:366)
at com.sybase.jdbc2.jdbc.SybResultSet.getClob(SybResultSet.java:1371)
at
com.ibatis.sqlmap.engine.type.ResultGetterImpl.getClob(ResultGetterImpl.java
:108)
at
com.ibatis.sqlmap.engine.type.ClobTypeHandlerCallback.getResult(ClobTypeHand
lerCallback.java:28)
at
com.ibatis.sqlmap.engine.type.CustomTypeHandler.getResult(CustomTypeHandler.
java:52)
at
com.ibatis.sqlmap.engine.mapping.result.BasicResultMap.getPrimitiveResultMap
pingValue(BasicResultMap.java:552)
at
com.ibatis.sqlmap.engine.mapping.result.BasicResultMap.getResults(BasicResul
tMap.java:311)
at
com.ibatis.sqlmap.engine.execution.SqlExecutor.handleResults(SqlExecutor.jav
a:390)
at
com.ibatis.sqlmap.engine.execution.SqlExecutor.executeQuery(SqlExecutor.java
:184)
at
com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.sqlExecuteQuery(
GeneralStatement.java:205)
at
com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQueryWith
Callback(GeneralStatement.java:173)
at
com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQueryForO
bject(GeneralStatement.java:104)
at
com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForObject(SqlMapEx
ecutorDelegate.java:561)
at
com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForObject(SqlMapEx
ecutorDelegate.java:536)
at
com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.queryForObject(SqlMapSession
Impl.java:93)
at
com.ibatis.sqlmap.engine.impl.SqlMapClientImpl.queryForObject(SqlMapClientIm
pl.java:70)


----- Original Message -----
From: "Nathan Maves" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Tuesday, March 21, 2006 5:51 PM
Subject: Re: multiple setters


> Ahhh yeah...  not good don't have them.  :)
>
> They are against the java bean specification.
>
> Nathan
> On Mar 21, 2006, at 4:38 PM, Ben Munat wrote:
>
> > Hey All... I seem to remember someone talking recently about
> > difficulties with a property set by ibatis having multiple setters.
> > Does this ring a bell?
> >
> > b
>
>
>




Reply via email to