Hi Andrey,
 
Thanks for the eg code. I am still not clear about the javaType for the
byte[]. Since all parameters and results must be an Object at their
highest level in iBatis, what would be the corresponding javaType for
byte[].
 
We are using stored procedure to insert values into DB. As we dont want
to convert the byte[] to String, what would be the appropriate javaType?
 
 <parameterMap id="createSecKeyParamMap" class="secKey">
      <parameter property="secKey" jdbcType="CHARACTER"
javaType="java.lang.String" mode="IN" /> 
       <parameter property="secPwd" jdbcType="BLOB" javaType= ""
mode="IN" /> 
   </parameterMap>
 
Thanks & Regards,
Kumar
 

Important: This e-mail, including any attachment(s) hereto, is intended
only for the individual or entity to whom it is addressed. It may
contain proprietary, confidential or privileged information or attorney
work product belonging to Fidelity Business Services India Pvt. Ltd.
(FBS India) or its affiliates. If you are not the intended recipient of
this e-mail, or if you have otherwise received this e-mail in error,
please immediately notify the sender via return e-mail and permanently
delete the original mail, any print outs and any copies, including any
attachments. Any dissemination, distribution, alteration or copying of
this e-mail is strictly prohibited. The originator of this e-mail does
not guarantee the security of this message and will not be responsible
for any damages arising from any dissemination, distribution, alteration
or copying of this message and/or any attachments to this message by a
third party or as a result of any virus being passed on. Any comments or
statements made in this are not necessarily those of FBS India or any
other Fidelity entity. All e-mails sent from or to FBS India may be
subject to our monitoring and recording procedures. FBS India is an
Appointed Representative of Fidelity Investments International, which is
authorized and regulated by the United Kingdom Financial Services
Authority . Fidelity Investments International only gives information on
its products and services and does not give investment advice to private
clients based on individual circumstances

 


  _____  

        From: Andrey Rogov [mailto:[EMAIL PROTECTED] 
        Sent: Thursday, March 27, 2008 11:59 PM
        To: user-java@ibatis.apache.org
        Subject: Re: How to insert byte[] using iBatis into DB
        
        
        > The issue is the constructed String does not have the same
bytes in
        > different OS, thus results in junk value while decrypting. So
we wanted to
        > store it as byte[] in to DB.
        >
        > Can any one let me know how to accomplish this.
        
        Kumar, 
             this example for Oracle. I think, that it will work for DB2
too.
        
        public class password {
            private byte[] passwordData ;
        }
        
        //  insert data 
        <insert id="insertPassword" parameterClass="password">
               insert into table (  password  )   ( type BLOB )
                values ( #passwordData# )                   
        </insert>
        
        //  get data
        <resultMap id="pwdblob" class="password">         
                 <result column="password" property="passwordData"
jdbcType="BLOB"/>   
        </resultMap>
        
        <statement id="getPassword" resultMap="pwdblob"
parameterClass="user">
              select password from db2.table where user=#id#   
        </statement>
        
        Andrey.
        
        
        ///  IBM DB2 sample for CLOB & BLOB .
        
http://publib.boulder.ibm.com/infocenter/db2luw/v8/index.jsp?topic=/com.
ibm.db2.udb.doc/ad/samples/sqlj/s-BlobClobDemo-sqlj.htm
        
        
        2008/3/27, Tony Lenzi <[EMAIL PROTECTED]>: 

                Kumar,
                
                You could base 64 encode your byte array, that would
preserve it as
                you move from OS to OS, then let Java decode the base 64
string and
                then decrypt it.
                
                If you need to store the byte array, we just use a blob
JDBC type in
                our mappings of byte arrays from iBatis to MySQL.  Not
sure how that
                would map to a byte[] in DB2.
                
                --
                
                Tony
                
                
                On Thu, Mar 27, 2008 at 9:32 AM, Elangovan, Kumaravel
                <[EMAIL PROTECTED]> wrote:
                >
                >
                >
                >
                > Hi,
                >
                > We have a encrypted byte array for the password. We
will construct a String
                > (String pwd = new String(byte[] password) insert in to
DB2 (The column
                > definition is CHARACTER(64) NOT NULL  FOR BIT DATA).
                >
                > The sqlmap for this is as follows.
                >
                > <parameter property="Pwd"       jdbcType="CHARACTER"
                > javaType="java.lang.String" mode="IN"/>
                >
                > The issue is the constructed String does not have the
same bytes in
                > different OS, thus results in junk value while
decrypting. So we wanted to
                > store it as byte[] in to DB.
                >
                > Can any one let me know how to accomplish this.
                >
                > Thanks & Regards,
                > Kumar
                >
                > Important: This e-mail, including any attachment(s)
hereto, is intended only
                > for the individual or entity to whom it is addressed.
It may contain
                > proprietary, confidential or privileged information or
attorney work product
                > belonging to Fidelity Business Services India Pvt.
Ltd. (FBS India) or its
                > affiliates. If you are not the intended recipient of
this e-mail, or if you
                > have otherwise received this e-mail in error, please
immediately notify the
                > sender via return e-mail and permanently delete the
original mail, any print
                > outs and any copies, including any attachments. Any
dissemination,
                > distribution, alteration or copying of this e-mail is
strictly prohibited.
                > The originator of this e-mail does not guarantee the
security of this
                > message and will not be responsible for any damages
arising from any
                > dissemination, distribution, alteration or copying of
this message and/or
                > any attachments to this message by a third party or as
a result of any virus
                > being passed on. Any comments or statements made in
this are not necessarily
                > those of FBS India or any other Fidelity entity. All
e-mails sent from or to
                > FBS India may be subject to our monitoring and
recording procedures. FBS
                > India is an Appointed Representative of Fidelity
Investments International,
                > which is authorized and regulated by the United
Kingdom Financial Services
                > Authority . Fidelity Investments International only
gives information on its
                > products and services and does not give investment
advice to private clients
                > based on individual circumstances
                >
                


Reply via email to