Faisal
Faisal

Reputation: 1569

How to Store the Images into PostgreSQL using wso2esb and wso2dss

I am using wso2esb4.7.0 , wso2dss 3.0.1 and posgresql 9.1.4 In postgresql i used data type bytea and in wso2dss 3.0.1 we dont have bytea so i used binary data type while i am inserting via dss it inserting the values but selecting query is not working In wso2esb or wso2dss has any example for this data is saving in this format x5c78 but selection time its not showing in dss what is the issue

<query id="insert_testing_query" useConfig="default">
      <sql>INSERT INTO public.testing(username,password,remoteaddress,result,img) VALUES(?,?,?,?,?)</sql>
      <param name="username" ordinal="1" sqlType="STRING"/>
      <param name="password" ordinal="2" sqlType="STRING"/>
      <param name="remoteaddress" ordinal="3" sqlType="STRING"/>
      <param name="result" ordinal="4" sqlType="STRING"/>
      <param name="img" ordinal="5" sqlType="BINARY"/>
   </query>
   <operation name="insert_testing_operation">
      <call-query href="insert_testing_query">
         <with-param name="result" query-param="result"/>
         <with-param name="remoteaddress" query-param="remoteaddress"/>
         <with-param name="username" query-param="username"/>
         <with-param name="img" query-param="img"/>
         <with-param name="password" query-param="password"/>
      </call-query>
   </operation>

Upvotes: 0

Views: 135

Answers (1)

Chanikag
Chanikag

Reputation: 1439

In the select query the element should be in the xs:base64 type. Please refer this doc. Here is a sample dataservices configuration for select query.

    <query id="select_testing_query" useConfig="default">
      <sql>SELECT username,password,remoteaddress,result,img FROM public.testing</sql>
      <result element="SAMPLECollection" rowName="SAMPLE">
         <element column="username" name="username" xsdType="xs:string"/>
         <element column="password" name="password" xsdType="xs:string"/>
         <element column="remoteaddress" name="remoteaddress" xsdType="xs:string"/>
         <element column="result" name="result" xsdType="xs:string"/>
         <element column="img" name="img" xsdType="xs:base64"/>
      </result>
  </query>
   <operation name="select_testing_operation">
      <call-query href="select_testing_query"/>
   </operation>

Upvotes: 1

Related Questions