From: Anilk at zenithsoft.com (Anil K Krishna)
Date: Tue, 30 Dec 2014 05:45:35 +0000
Subject: [Pljava-dev] Issue with xml column
Message-ID:
<4F3EFA2C9B56AD47AF2FCD3C7FD14A8701159928BF@VS1-Exchange.blr-zenithsoft.net>
Hi,
I am using PL java to insert data into the postgres sql database table. One of my tables has column of type XML.
I am inserting data using prepared statement as shown below
String sql = "Insert into company (name, address, phone) values (? , ?::xml, ?);
String xmlData = " 11 ";
pstmt = connection.prepareStatement(sql);
pstmt.setString(1,"TEST");
pstmt.setString(2, xmlData);
pstmt.setString(3,"001456766");
pstmt.executeUpdate();
However when the above code is executed it inserting the xml column has with data having all the new characters as shown below
ADDRESS column value in db is
\n\t\n\t\n\t 11\n\t \n\t \n\t
I would like to know why is this \n\t is inserted is there a way to avoid it.
Also if I use the code below in PL java I am getting exception
SQLXML sqlXML = connection.createSQLXML();
sqlXML.setString(xmlData);
pstmt.setSQLXML(2, sqlXML);
Thanks
Anil Kumar Krishna
Anil Kumar Krishna | Sr. Project Manager
Zenith Software Limited
Phone: +91 80 25525690
Mobile: +91 9972585161
Email: anilk at zenithsoft.com URL: www.zenithsoft.com
________________________________
DISCLAIMER: The information contained in this e-mail is confidential and is intended for use by the addressee only. Any views or opinions presented in this e-mail are solely those of the author and may not necessarily reflect the opinions of Zenith Software Limited. Any unauthorised dissemination or copying of this e-mail and any use or disclosure of information contained in it, is strictly prohibited and may be illegal. Please let us know immediately by return e-mail, if the e-mail has been sent to you in error.
________________________________
-------------- next part --------------
An HTML attachment was scrubbed...
URL: