osdir.com

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Python-Dev] How can i insert more than 32K data to a column type clob in db2 using python programming


 Hi Team,

I have tried to insert in clob data type more than 32k byte data but
getting error:-

Statement Execute Failed: [IBM][CLI Driver][DB2/LINUXX8664] SQL0102N  The
string constant beginning with "\'<p>Hi good day team:<br /> We had been
requested to Add Anniel to all" is too long.  SQLSTATE=54002 SQLCODE=-102

could any one please help me is there any way i can achieve it?

Please find my DDL statement:-

CREATE TABLE "DB2IDEV "."CHANGE"  (
          "TICKET_ID" INTEGER NOT NULL ,
          "SHORTDESC" VARCHAR(5000 OCTETS) NOT NULL ,
          "LONGDESC" CLOB(2147483647 OCTETS) LOGGED NOT COMPACT ,
          "RELEASENUM" VARCHAR(12 OCTETS) WITH DEFAULT NULL ,
          "ISSOFTDELETED" INTEGER NOT NULL WITH DEFAULT 0 ,
          "CREATETIMESTAMP" TIMESTAMP NOT NULL WITH DEFAULT CURRENT
TIMESTAMP ,
          "LASTUPDATETIMESTAMP" TIMESTAMP WITH DEFAULT NULL )
         IN "TABLESPACE"
         ORGANIZE BY ROW  ;

 conn =
db.connect("DATABASE=%s;HOSTNAME=%s;PORT=60001;PROTOCOL=TCPIP;UID=%s;PWD=%s;"%(DB2_DATABASE,DB2_HOSTNAME,DB2_UID,DB2_PWD),
"", "")
cursor = conn.cursor()

sql="INSERT INTO Change
(Ticket_ID,shortDesc,longDesc,releaseNum,isSoftDeleted,createTimeStamp,lastUpdateTimeStamp)
VALUES ('296129','High Cisco Adaptive Security Appliance Remote Code
Execution and Denial of Service Vulnerabilit','<Some long data around
50KB>',NULL,'0','2018-02-07 02:11:50',NULL)"

cursor.execute(sql)
conn.commit()

Thanks & Regards

*Aman Agrawal*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20190108/122fd3fe/attachment.html>