I am faceing one problem, while inserting the data in db2 using clob. actually i am writing this type code:
Expand|Select|Wrap|Line Numbers
- public class DBParam
- {
- private InputStream inputstream;
- private static int htmLength=0;
- public DBParam(String c,String k) //k has the data of html
- {
- this.inputStream=getStreams(k);
- this.htmlLength=k.length();
- }
- public InputStream getStreams(String html);
- {
- byte array[]=html.getBytes();
- InputStream is=new ByteArrayInputStream(array);
- return is;
- }
- protected InputStream getStreamData()
- {
- return inputStream;
- }
- protected static int getLength()
- {
- return htmllength;
- }
- }//it is the DBParam class.
- we are calling this method to dao class that is BillingDAO
- public class BillingDAO
- {
- public static void insertBillingDetails(String html,String accountnumber,String billDate)
- {
- DBSql dbsql=DBSql.createDBsql("billing","billing_insert");
- dbsql.setInputParam(new DBParam(Types.VARCHAR,Accountnumber);
- dbsql.setInputParam(new DBParam(Types.DATE,billdate);
- dbsql.setInputParam(new DBParam(Types.CLOB,html);
- dbAccessor.execute(dbsql);
- }
- DBSql.java
- ---------------
- in this i am writing this code for CLOB
- public void setInputParam(preparedStatement kk)
- {
- case Types.CLOB:
- InputStream inputstream=DBParam.getStream();
- int length=DBParam.getLength();
- preparedStatement.setBinaryStream(index,inputStream,length);
- }
Expand|Select|Wrap|Line Numbers
- <billing>
- <billing_insert>
- insert into view_imagehistory values(?,?,?);
- </billing_insert>
- </billing>
The hole date placed in html String. in that string total characters around 12000
we got the problem in this statement i.e dbsql.setInputParam(new DBParam(Types.CLOB,html);
please help me for this problem
Advanced Thanks
Srinu