473,396 Members | 1,892 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

inserting clob data in db2 database

hi,
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
  1. public class DBParam
  2. {
  3. private InputStream inputstream;
  4. private static int htmLength=0;
  5. public  DBParam(String c,String k) //k has the data of html
  6. {
  7. this.inputStream=getStreams(k);
  8. this.htmlLength=k.length();
  9. }
  10.  
  11. public InputStream getStreams(String html);
  12.  
  13. {
  14.  byte array[]=html.getBytes();
  15. InputStream is=new ByteArrayInputStream(array);
  16. return is;
  17. }
  18. protected InputStream getStreamData()
  19. {
  20. return inputStream;
  21.  
  22. }
  23. protected static int getLength()
  24. {
  25. return htmllength;
  26. }
  27. }//it is the DBParam class.
  28.  
  29. we are calling this method to dao class that is BillingDAO
  30.  
  31. public class BillingDAO
  32. {
  33. public static void insertBillingDetails(String html,String accountnumber,String billDate) 
  34. {
  35. DBSql dbsql=DBSql.createDBsql("billing","billing_insert");
  36. dbsql.setInputParam(new DBParam(Types.VARCHAR,Accountnumber);
  37. dbsql.setInputParam(new DBParam(Types.DATE,billdate);
  38. dbsql.setInputParam(new DBParam(Types.CLOB,html);
  39.  
  40. dbAccessor.execute(dbsql);
  41. }
  42.  
  43.  
  44.  
  45. DBSql.java
  46. ---------------
  47.  
  48.  
  49. in this i am writing this code for CLOB
  50. public void setInputParam(preparedStatement kk)
  51. {
  52. case Types.CLOB:
  53. InputStream inputstream=DBParam.getStream();
  54. int length=DBParam.getLength();
  55. preparedStatement.setBinaryStream(index,inputStream,length);
  56.  
  57. }
in configaration file i am writing one insert query
Expand|Select|Wrap|Line Numbers
  1. <billing>
  2. <billing_insert>
  3. insert into view_imagehistory values(?,?,?);
  4. </billing_insert>
  5. </billing>
the above code, we face the problem like Indexoutofbound exception.
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
Nov 27 '07 #1
0 2716

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: freak | last post by:
hi i have problems reading an oracle(9i) clob from a php-script with the MDB-class from pear. the table files has 3 fields: id integer document clob picture clob
0
by: spennine | last post by:
Greetings all, we have some Java code that inserts to MVS/DB2 V6.1. We use the setObject() method, passing it a character array as the 2nd argument, and specify the type as the 3rd argument,...
1
by: sea | last post by:
When I use app driver, I get error reading clob data from the database. Below is how this is done using odbc, the same code does not work with jdbc app driver though, any suggestions on how to read...
1
by: Srinadh | last post by:
Hi all, We have files with about 20 to 30 fields per row. We are trying to update such files with about 60 rows as contiguous data in a CLOB field. It passes through. But when we try...
5
by: gimme_this_gimme_that | last post by:
In Oracle you can have a statement such as insert into foo (foo_id,some_clob) values (100,empty_clob()) where empty_clob() inserts a clob address. What is the approach in DB2 (8.1) to...
1
by: DJ DIGI | last post by:
Hello Everyone, I'm attempting to design a small web app to obtain customer feedback. The issue is when a user inputs >4000 characters in the COMMENTS section I get the following Err Msg: ...
4
by: Nikki | last post by:
When executing my insert statement, I am receiving the error message 'string literal too long'. The field is an xml datatype and I am inserting the xml as a string. Do I need to convert it to a...
3
by: t2581 | last post by:
Hi , I have database db2 udb 7.2 with following table and datatype CREATE DISTINCT TYPE APP.NOTEPAD AS SYSIBM .CLOB(4096); CREATE TABLE APP.AP_NOTE_PAD ( CONTROL_LOCATION INTEGER NOT NULL...
7
by: Ian Boyd | last post by:
Customer wanted us to figure out why their database was growing at an astronomical rate. We broke down the various fields making up a table, and we found that the ..LB file was using about 1k...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.