5 Replies Latest reply on Jul 30, 2012 8:59 AM by oliver

    JDBC

    oliver

      Hi all,

       

      Just wondering if anyone who have experience on using the GetAs function on retrieving the content from a container field.

       

      I am working on some experiment without success.

       

      Basically, I am trying to draw the data from a container field named "photo" that stored a jpeg file.

       

      Example:

       

      SELECT GetAs(photo, 'JPEG') as pic FROM company where company_id = 1;

       

       

      When viewing the content from the field alias "pic", it shows up some strange characters like this "

       

      ��� JFIF ��� ' $! "/ #'*,,, 150*5&,,) -% $,,/*,))))),))))),,,),)),),,,,)),2,),,),),*),)),,,,�� `P " �� ��9 ! 1 AQ "aq�b��#2BR�� ��� &3s��� ��! !"1 A Qa�� ?�R4�S' hrXu���I�I �� Ɋc��� �)3 s��s� p�n;B)�.X��*,߫�G}��� �Go �/�Rp1���x��ɗe rT � 2 5 vr���m�6�͗4�N��� � pH�>C&�~ʼn�C1h��� g�I� ��M8M ��#�� �~�"��ʦRX � �l D�O���G��A�(�r��H� �1�� �� �i |-yZ� K�� ���X�y]y� B� &#127; 8 &#127; ��y ЕOh�< ) F 9 g��U�_u�2�� t�m� �Ʀ�i�� � 8�� ��1c�0Ĥj �3�g�Lm�O+> �!a�� �8 �� �'P�ڍ�V� ! ~y��I*Q�����R� � u:�6��# ��eY)t�w� ��f�>� ��B�Ȇ��-� *ǫ&#127;f ɩ R�Lԥ�<��<�+g �e ��Qys �� �5 L[�tͥc�w ��u�w g �R�I a���ܔ~��;���Z��R @%���vnl1 ���(4��>�[����D� Y�F �~�X7� �T4� ���' $ �{7�d � x_� � PβV �G�$ :�X�Ӧ ���^� � b�}#�� �ҹ�u3^� x��� �ţUX� �lRgg�%�y���d�� m� � ����T�&#127;�G�G� N-v�+�� ��?=C�b��� }� I��c 'h� �� �>�� ����R��^g�1�J �H�J[*E �Se� $ �>�� X w�Ϡ��_x> � UǕ)��2H��0��g �5C� ���� &#127;� )�H�B�-�S��;�^~P ��s��%9�1'��� I.�x�, #Jq �����U�x� �Q� Zj�n��-��MI>� 4t�4�T��} Xc{z ���,KI3B[:��N~��� _u� ä�>QE {S�,� ��a�HS �Ѣ-4ɡ�˖����� E W�y�Ud)�3�2<@|C#���̭���֒�IRBO�� �j f��,�J��}�J~ $ �s� �GJ ��������U'5 e!;�J s�� ��"+j^ �ꕢ�|� xJ��|�Z��ܢ�3�Nb$ʹRf��)E� $��E?L(MǴ �K ���J� x �|!��n�� @` � =��#��z�&#154;Q[ Kt�x�Q��+���p%<�� G�Y�Z� /� h}��M (HK �$��s H�"�#I ��� ʍZ��Rn�� � MW �����P# R @I�H��t� @� Y��ϼ x,k�VY7��^Q �� ��H����'��>� }��� ��Y�(�� � u����O���!��F ���ȅZ� QI� p��V��� p=" #Ԅ� �K�]�p A��pS� � 'ڻ�s|)#� � ���� �.t�� ��Ҡ����ǵD�2� yz�eOS$ d�Y f�>�䪑 �U���� �By� ��k ��_ �C M� �K%�o� �9 )2�@a� � [�0�'��[3�zO� � ���]�a$�)RYZw ��#���eܤ }I&#134;�RO=I���U�i�e�"�]A�NҜ�����X�� R� ����� � �� �4�<�)��� �P7�Њ 2�$kS�� �%G'np�N� �|$�/�r��S�� 幜�O$�Ҕ�=O�>SN ���1L�f�d�I>!��1�~`E�a� ��T�7� : � P^'Si�*�W5_A+��.g�K I%���H� &1[�?4t�� a F� �g�R�A ��&C��� D���W����Q8��u�'���� �m�T��m�'��� :T�� _ Mm� �F&#127;X�*t�L ��|���Ƒ� 0 m �t�(�>� ڃM� ��� pQg���J���

       

       

       

       

      Any clue? or success case on using the GetAs function.

       

       

      Thanks,

      Oliver

        • 1. Re: JDBC
          beverly

          That's the encoded format for JPEG <http://en.wikipedia.org/wiki/JPEG_File_Interchange_Format>. It's not expected to be "human-readable".

           

          When you say "viewing the content", what do you mean? How are you trying to view the image? what method (using JDBC, obviously) are you using? If on web, what application(s) are used?

           

          Beverly

          • 2. Re: JDBC
            oliver

            Thanks Beverly,

             

            I understand it's not readable. What I am trying to build a query to retrieve the container's content to display it on web. I am using ColdFusion to query the content and expect it's in binary data format but return data type looks not right.

             

            Oliver

            • 3. Re: JDBC
              beverly

              Ok, what ColdFusion tags and/or other HTML/JS are you using to push the image? (and what version of ColdFusion?)

               

              something like?

                    (called as 'src' of 'img' tag)

               

              Beverly

              • 4. Re: JDBC
                oliver

                Thanks, Coldfusion 9 is used and the tag used are cfquery and cffile mainly.

                 

                The tag CFQUERY is used to execute the SQL and the CFFILE tag is used to save the photo field to a jpeg file. In our case, we try to work out the possibility to retrieve container field content and display it on the web page. Beforehand, we won't to confirm it's possible to retrieve the content and put it into a file.

                 

                 

                Thanks,

                Oliver

                • 5. Re: JDBC
                  oliver

                  Would someone who use the GetAs function sharing their experience on this? It is pretty difficult to find relevant reference from the community.

                   

                  Oliver