How to store images or Folders in "/i/" (image directory) located in XDB

Hi All,
Technical Description:
Oracle APEX Version: Application Express 4.1.0.00.32
Database Version: Oracle Database 10g Express Edition Release 10.2.0.1.0 - Product
OS: Mac OS
Now my question is:
How to upload images and theme folders from front end ? ie how to upload a image to "'http://localhost:8080/i/" and theme to "'http://localhost:8080/i/themes" available in XDB from the Front end.
Please give me some hints about how to achieve this.
Thanks & Regards,
Prashant

Hi Alex Nuijten,
Thanks for replying.
I know how to access "/i/" folder using FTP but I want to write file into specific directory under "/i/" directory, that too using my APEX application front-end.
(Like, how we upload a file into table in the same way i want to upload a file to specific directory under "/i/")
Thanks & Regards,
Prashant

Similar Messages

  • How to store photos in folders on iPad 2

    looking for the best way to sync photos to the iPad 2 without loosing the folder structure.

    You can sync separate folders from your computer, and each folder should get it's own album on the iPad - you need to sync all the folders that you want in one go (so they will need to be directly off the same parent folder), as only the contents of the most recent photo sync remain on the iPad (not including a folder in a sync is how you delete that folder/album from the iPad). More general info on photo syncing here http://support.apple.com/kb/HT4236 . You can't have sub-folders/albums on the iPad. If you have a Mac then you sync photo albums/events/faces via iPhoto or Aperture
    With iOS 5 in the Autumn you should (assuming that it makes it in the final release) be able to move photos between albums directly on the iPad.

  • How to store the File Name from a Unix Directory into a ODI variable?

    Hi,
    I have built a ODI package with the following steps:
    1. ODI is polling for a flat file in a Unix directory. I have used OdiFileWait tool for this purpose. Here the file name is not fixed, so I am using wild character (*) to poll for file. Example: DF*ABC1*.DAT where the first wild character denotes 1 letter and the second wild character denotes 2 digits.
    2. In the second step, if the file is found, I am moving the file to ODI file server path (../oracledi/demo/file). Here I have used ODIFileMove tool.
    3. Then I am using an ODI Interface to Load the file data into a Oracle database table.
    4. I am using a Process log table to keep the log for each step I am executing in ODI that is ODIFileWait, ODIFileMove, Interface etc. for each file. In this table a row needs to be inserted after ODIFileWait tool gets the file, with the File Name and File Date. Later on this row will be updated as the consequent steps are executed.
    Here is my concern, I need to get the exact File Name of the file after ODIFileWait gets the file and I need to insert that in the Process Log table after the ODIFileWait step gets a file. So if I can store the File Name in a ODI Variable, I can insert it into the Process log table at this point. This I am not able to do.
    The files are coming in a different directory (not in ODI file server path), So after getting the file it is moved to ODI file server path (../oracledi/demo/file)
    The Files which I am processing are fixed length format. Also, the File name and File Date is stored in the 1st Record(Header record) of the files.
    Kindly provide me suggestions to implement this in my code.
    Thanks and Regards,
    Anik
    Edited by: 809820 on Nov 10, 2010 11:36 PM

    Look at this link -http://odiexperts.com/getting-one-or-several-unknown-files-from-a-directory
    change the command to fetch the ls command and write into File and then using either java or jython break the data and fetch the file name and date and insert into log table.
    (or)
    you can use the os.system command and get the complete ls command into string and then process and insert it.
    Let us know if you need any other help.

  • Make folders visible with images as in Pc?

    I've switched from Pc to Mac and I wonder how I can make the folders show the images? As the folders show blank from the outside - so I can't see what is inside! Only after I click on it! Is there away to make images visible in the folders?

    Hi,
    Are you regenerating a new installer with B1DE 1.3 or are you upgrading your old installer to VS2005?
    If you are regenerating your installer, what kind of error are you having? Do you have a directory in your project called AddOnRegDataGenFile? Can you check the contents of the files is correct (mainly the path and file names)?
    The installer.exe is created without problem?
    If you are upgrading the installer project:
    How are you trying to regenerate the .ard file? Are you using the .bat files autogenerated by B1DE installer wizard?
    If it is the case you should check the .bat and .xml files inside the AddOnRegDataGenFile directory of your installer. This files have the complete path of many needed files, if you have moved this files to a different location or changed the name of a directory then the .bat files will not work anymore.
    Please check the .bat and .xml contents, specially the paths and file names.
    Regards
    Trinidad.

  • How to store an image into MySQL db using BlazeDS and Hibernate?

    Hi!
    I am using Flash Builder 4.6, BlazeDS, and Hibernate. How to store a webcam snapshot into the MySql Database. I stored Form Items by using RemoteObject into the database. But I failed to store webcam snapshot. I captured that image on Panel component.I converted that image to ByteArray. Now I want to save that image into the database. Please help me in this regard.
    thanks in advance.
    Here the Code:
    VisitorEntryForm.mxml
    <?xml version="1.0" encoding="utf-8"?>
    <mx:TitleWindow
              xmlns:mx="http://www.adobe.com/2006/mxml"
              xmlns:vo="com.visitor.vo.*"
              width="600"
              height="300"
              defaultButton="{submitButton}"
              showCloseButton="true"
              creationComplete="creationCompleteHandler();"
              close="PopUpManager.removePopUp(this);"
              title="Visitor Entry Form" xmlns:text="flash.text.*">
              <mx:RemoteObject id="saveService" destination="visitorService" result="handleSaveResult(event)" fault="handleFault(event)" showBusyCursor="true" />
              <vo:Visitor id="visitor"
                                               vType="{vTypeField.text}"
                                               vPurpose="{vPurposeField.text}"
                                               vName="{vNameField.text}"
                                               vAddress="{vAddressField.text}"
                                               cPerson="{cPersonField.text}"
                                               cAddress="{cAddressField.text}"
                                     />
                        <mx:Script>
                        <![CDATA[
                        import mx.managers.PopUpManager;
                        import flash.media.Camera;
                        import com.visitor.vo.WebCam;
                        import com.visitor.vo.Base64;
                        import mx.core.UIComponent;
                        import mx.graphics.codec.JPEGEncoder;
                        import mx.controls.Alert;
                        import mx.containers.Canvas;
                        import mx.rpc.events.ResultEvent;
                        import mx.rpc.events.FaultEvent;
                        import mx.events.ValidationResultEvent;
                        import mx.validators.Validator;
                                  [Bindable]
                                  private var webCam: com.visitor.vo.WebCam;
                                  [Bindable]
                                  private var message:String;
                                  [Bindable]
                                  private var formIsValid:Boolean = false;
                                  [Bindable]
                                  public var formIsEmpty:Boolean;
                                  private var focussedFormControl:DisplayObject;
                                  private function handleSaveResult(ev:ResultEvent):void {
                                            clearFormHandler();
                                            validateForm(ev);
                                            Alert.show("Visitor successfully created/updated.", "Information", Alert.OK, null, null, null, Alert.OK);
                                            // Reload the list.
                                            parentApplication.listConsultants.loaderService.getConsultants();
                                            PopUpManager.removePopUp(this);
                                  private function handleFault(ev:FaultEvent):void {
                                            message = "Error: " + ev.fault.faultCode + " \n "
                                                      + "Detail: " + ev.fault.faultDetail + " \n "
                                                      + "Message: " + ev.fault.faultString;
                                  public function saveVisitor():void {
                                            saveService.addUpdateVisitor(visitor);
                                  private function creationCompleteHandler():void {
                                            init();
                                            PopUpManager.centerPopUp(this);
                                            resetFocus();
                                  private function resetFocus():void {
                                            focusManager.setFocus(vTypeField);
                                  public function validateForm(event:Event):void  {
                                            focussedFormControl = event.target as DisplayObject;   
                                            formIsValid = true;
                                            // Check if form is empty
                                            formIsEmpty = (vTypeField.text == "" && vPurposeField.text == "" && vNameField.text == "" && vAddressField.text == "" && cPersonField.text == "" && cAddressField.text == "");
                                            validate(vTypeValidator);               
                                            validate(vPurposeValidator);
                                            validate(vNameValidator);
                                            validate(vAddressValidator);
                                            validate(cPersonValidator);
                                            validate(cAddressValidator);
                                  private function validate(validator:Validator):Boolean {
                                            var validatorSource:DisplayObject = validator.source as DisplayObject;
                                            var suppressEvents:Boolean = (validatorSource != focussedFormControl);
                                            var event:ValidationResultEvent = validator.validate(null, suppressEvents);
                                            var currentControlIsValid:Boolean = (event.type == ValidationResultEvent.VALID);
                                            formIsValid = formIsValid && currentControlIsValid;
                                            return currentControlIsValid;
                                  private function clearFormHandler():void {
                                            // Clear all input fields.
                                            vTypeField.text = "";
                                            vPurposeField.text = "";
                                            vNameField.text = "";
                                            vAddressField.text = "";
                                            cPersonField.text = "";
                                            cAddressField.text = "";
                                            message = "";
                                            // Clear validation error messages.
                                            vTypeField.errorString = "";
                                            vPurposeField.errorString = "";
                                            vNameField.errorString = "";
                                            vAddressField.errorString = "";
                                            cPersonField.errorString = "";
                                            cAddressField.errorString = "";
                                            formIsEmpty = true;
                                            formIsValid = false;
                                            resetFocus();
                                  private function init():void {
                                  webCam = new WebCam(97,97);
                                  var ref:UIComponent = new UIComponent();
                                  preview.removeAllChildren();
                                  preview.addChild(ref);
                                  ref.addChild(webCam);
                                  private function takeSnapshot():void {
                                  imageViewer.visible = true;
                                  imageViewer.width = preview.width;
                                  imageViewer.height = preview.height;
                                  var uiComponent : UIComponent = new UIComponent();
                                  uiComponent.width = webCam.width;
                                  uiComponent.height = webCam.height;
                                  var photoData:Bitmap = webCam.getSnapshot();
                                  var photoBitmap:BitmapData = photoData.bitmapData;
                                  uiComponent.addChild(photoData);
                                  imageViewer.removeAllChildren();
                                  imageViewer.addChild(uiComponent);
                                  private function uploadSnapshot():void
                                            if (imageViewer.getChildren().length > 0)
                                                      var uic:UIComponent = imageViewer.getChildAt(0) as UIComponent;
                                                      var bitmap:Bitmap = uic.getChildAt(0) as Bitmap;
                                                      var jpgEncoder:JPEGEncoder = new JPEGEncoder(75);
                                                      var jpgBytes:ByteArray = jpgEncoder.encode(bitmap.bitmapData);
                                  private function deleteSnapshot():void
                                            imageViewer.removeAllChildren();
                        ]]>
                        </mx:Script>
              <mx:StringValidator id="vTypeValidator"          source="{vTypeField}"          property="text" minLength="2" required="true" />
              <mx:StringValidator id="vPurposeValidator" source="{vPurposeField}"          property="text" minLength="2" required="true" />
              <mx:StringValidator id="vNameValidator"          source="{vNameField}"          property="text" minLength="2" required="true" />
              <mx:StringValidator id="vAddressValidator"          source="{vAddressField}"          property="text" minLength="5" required="true" />
              <mx:StringValidator id="cPersonValidator" source="{cPersonField}"          property="text" minLength="2" required="true" />
              <mx:StringValidator id="cAddressValidator"          source="{cAddressField}"          property="text" minLength="5" required="true" />
              <mx:Grid width="575" height="211">
                        <mx:GridRow width="575" height="211">
                                  <mx:GridItem width="301" height="235">
                                            <mx:Form width="301" height="208">
                                                      <mx:FormItem label="Visitor's Type">
                                                                <mx:ComboBox id="vTypeField" text="{visitor.vType}" change="validateForm(event);" editable="true">
                                                                          <mx:Array>
                                                                                    <mx:String></mx:String>
                                                                                    <mx:String>Contractor</mx:String>
                                                                                    <mx:String>Supplier</mx:String>
                                                                                    <mx:String>Transporter</mx:String>
                                                                                    <mx:String>Plant</mx:String>
                                                                                    <mx:String>Non-Plant</mx:String>
                                                                          </mx:Array>
                                                                </mx:ComboBox>
                                                      </mx:FormItem>
                                                      <mx:FormItem label="Visit Purpose">
                                                                <mx:ComboBox id="vPurposeField" text="{visitor.vPurpose}" change="validateForm(event);" editable="true">
                                                                          <mx:Array>
                                                                                    <mx:String></mx:String>
                                                                                    <mx:String>Official</mx:String>
                                                                                    <mx:String>Personal</mx:String>
                                                                          </mx:Array>
                                                                </mx:ComboBox>
                                                      </mx:FormItem>
                                                      <mx:FormItem label="Visitor's Name">
                                                                <mx:TextInput id="vNameField"  text="{visitor.vName}" change="validateForm(event);"/>
                                                      </mx:FormItem>
                                                      <mx:FormItem label="Address">
                                                                <mx:TextInput id="vAddressField"   text="{visitor.vAddress}" change="validateForm(event);"/>
                                                      </mx:FormItem>
                                                      <mx:FormItem label="Contact Person">
                                                                <mx:TextInput id="cPersonField"  text="{visitor.cPerson}" change="validateForm(event);"/>
                                                      </mx:FormItem>
                                                      <mx:FormItem label="Address">
                                                                <mx:TextInput id="cAddressField"  text="{visitor.cAddress}" change="validateForm(event);"/>
                                                      </mx:FormItem>
                                                      </mx:Form>
                                  </mx:GridItem>
                                  <mx:GridItem width="264" height="193">
                                            <mx:Grid width="241" height="206">
                                                      <mx:GridRow width="100%" height="100%">
                                                                <mx:GridItem width="100%" height="100%" horizontalAlign="center" verticalAlign="middle">
                                                                          <mx:Panel width="100" height="132" title="Snap" id="preview" layout="absolute"/>
                                                                </mx:GridItem>
                                                                <mx:GridItem width="100%" height="100%" horizontalAlign="center" verticalAlign="middle">
                                                                          <mx:Panel width="100" height="132" title="Preview" id="imageViewer"  layout="absolute"/>
                                                                </mx:GridItem>
                                                      </mx:GridRow>
                                                      <mx:GridRow width="100%" height="27" >
                                                                <mx:GridItem width="100%" height="100%" horizontalAlign="center">
                                                                          <mx:Button id="snapshot" x="2" width="106" height="27" label="Snap"
                                                                                                  click="takeSnapshot();"/>
                                                                </mx:GridItem>
                                                                <mx:GridItem width="100%" height="100%" horizontalAlign="center">
                                                                          <mx:Button id="deleteButton" x="1" width="106" height="27" label="Delete"
                                                                                                  click="deleteSnapshot();"/>
                                                                </mx:GridItem>
                                                      </mx:GridRow>
                                            </mx:Grid>
                                  </mx:GridItem>
                        </mx:GridRow>
              </mx:Grid>
              <mx:ControlBar height="40" horizontalAlign="center">
                        <mx:Button label="Save Visitor"          id="submitButton" enabled="{formIsValid}" click="saveVisitor();" />
                        <mx:Button label="Clear form" enabled="{!formIsEmpty}"          click="clearFormHandler();" />
                        <mx:Button label="Cancel" click="PopUpManager.removePopUp(this);"/>
                        <mx:Label width="211" id="state"/>
              </mx:ControlBar>
              <mx:Text text="{message}" fontWeight="bold" width="300"/>
    </mx:TitleWindow>
    ListVisitors.mxml
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Panel
              xmlns:mx="http://www.adobe.com/2006/mxml"
              xmlns:view="com.visitor.view.*"
              width="100%"
              height="100%"
              title="Visitor Management System - Found {visitorRecords} visitors."
              creationComplete="loadVisitors();">
              <mx:RemoteObject id="loaderService" destination="visitorService" result="handleLoadResult(event)"          fault="handleFault(event)" showBusyCursor="true" />
              <mx:RemoteObject id="deleteService" destination="visitorService" result="handleDeleteResult(event)"          fault="handleFault(event)" showBusyCursor="true" />
              <mx:Script>
                        <![CDATA[
                                  import com.visitor.vo.Visitor;
                                  import mx.controls.Alert;
                                  import mx.managers.PopUpManager;
                                  import mx.containers.TitleWindow;
                                  import mx.collections.ArrayCollection;
                                  import mx.rpc.events.ResultEvent;
                                  import mx.rpc.events.FaultEvent;
                                  [Bindable]
                                  private var message:String;
                                  [Bindable]
                                  private var visitors:ArrayCollection = new ArrayCollection();
                                  [Bindable]
                                  private var visitorRecords:int = 0;
                                  public function loadVisitors():void {
                                            loaderService.getVisitors();
                                  private function deleteVisitor():void {
                                            if(dataGrid.selectedItem != null) {
                                                      var selectedItem:Visitor = dataGrid.selectedItem as Visitor;
                                                      deleteService.deleteVisitor(selectedItem.visitorId);
                                  private function createVisitor():void {
                                            var titleWindow:VisitorEntryForm = VisitorEntryForm(PopUpManager.createPopUp(this, VisitorEntryForm, true));
                                            titleWindow.setStyle("borderAlpha", 0.9);
                                            titleWindow.formIsEmpty = true;
                                  private function updateVisitor():void {
                                            var titleWindow:VisitorEntryForm = VisitorEntryForm(PopUpManager.createPopUp(this, VisitorEntryForm, true));
                                            titleWindow.setStyle("borderAlpha", 0.9);
                                            titleWindow.visitor = dataGrid.selectedItem as Visitor;
                                            titleWindow.formIsEmpty = false;
                                  private function handleLoadResult(ev:ResultEvent):void {
                                            visitors = ev.result as ArrayCollection;
                                            visitorRecords = visitors.length;
                                  private function handleDeleteResult(ev:ResultEvent):void {
                                            Alert.show("The visitor has been deleted.", "Information", Alert.OK, null, null, null, Alert.OK);
                                            loadVisitors();
                                  private function handleFault(ev:FaultEvent):void {
                                            message = "Error: "
                                                      + ev.fault.faultCode + " - "
                                                      + ev.fault.faultDetail + " - "
                                                      + ev.fault.faultString;
                        ]]>
              </mx:Script>
              <mx:VBox width="100%" height="100%">
                        <mx:Label text="{message}" fontWeight="bold" includeInLayout="false" />
                        <mx:DataGrid
                                  id="dataGrid"
                                  width="100%"
                                  height="100%"
                                  dataProvider="{visitors}"
                                  doubleClickEnabled="true"
                                  doubleClick="updateVisitor()" >
                                  <mx:columns>
                                            <mx:DataGridColumn dataField="visitorId"          headerText="Visitor ID" width="100"/>
                                            <mx:DataGridColumn dataField="vType"                    headerText="Visitor's Type" />
                                            <mx:DataGridColumn dataField="vPurpose"           headerText="Visit Purpose" />
                                            <mx:DataGridColumn dataField="vName"                     headerText="Visitor's Name" />
                                            <mx:DataGridColumn dataField="vAddress"                    headerText="Visitor's Address" />
                                            <mx:DataGridColumn dataField="cPerson"                     headerText="Contact Person" />
                                            <mx:DataGridColumn dataField="cAddress"                    headerText="Contact Address" />
                                            <mx:DataGridColumn dataField="timeIn"                     headerText="Time-In" />
                                            <mx:DataGridColumn dataField="timeOut"                     headerText="Time-Out" />
                                            <mx:DataGridColumn dataField="vPhoto"                     headerText="Visitor's Photo" />
                                  </mx:columns>
                        </mx:DataGrid>
                        <mx:ControlBar horizontalAlign="center">
                                  <mx:Button label="Create Visitor"          click="createVisitor()"          toolTip="Create a new visitor and store it in the database." />
                                  <mx:Button label="Update Visitor"          click="updateVisitor()"           enabled="{dataGrid.selectedItem}" toolTip="Update an existing database visitor." />
                                  <mx:Button label="Delete Visitor"          click="deleteVisitor()"          enabled="{dataGrid.selectedItem}" toolTip="Delete the visitor from the database." />
                                  <mx:Button label="Reload Data"                    click="loadVisitors()"           toolTip="Reload the visitor list from the database." />
                        </mx:ControlBar>
              </mx:VBox>
    </mx:Panel>
    Visitor.as
    package com.visitor.vo
              import mx.controls.Image;
              import spark.primitives.BitmapImage;
              [Bindable]
              [RemoteClass(alias="com.visitor.Visitor")]
              public class Visitor
                        public function Visitor()
                        public var visitorId:Number;
                        public var vType:String;
                        public var vPurpose:String;
                        public var vName:String;
                        public var vAddress:String;
                        public var cPerson:String;
                        public var cAddress:String;
                        public var timeIn:Date;
                        public var timeOut:Date;
                       public var vPhoto: Image;
    Visitor.java
    package com.visitor;
    import java.sql.Blob;
    import java.sql.Timestamp;
    import javax.persistence.Basic;
    import javax.persistence.Column;
    import javax.persistence.Entity;
    import javax.persistence.GeneratedValue;
    import javax.persistence.GenerationType;
    import javax.persistence.Id;
    import javax.persistence.NamedQueries;
    import javax.persistence.NamedQuery;
    import javax.persistence.Table;
    import org.hibernate.annotations.Index;
    @Entity
    @Table(name = "visitors")
    @NamedQueries( {
                        @NamedQuery(name = "visitors.findAll", query = "from Visitor"),
                        @NamedQuery(name = "visitors.byId", query = "select v from Visitor v where v.visitorId= :visitorId") })
    public class Visitor {
              @Id
              @GeneratedValue(strategy = GenerationType.AUTO)
              @Column(name = "visitorId", nullable = false)
              private Long visitorId;
              @Basic
              @Index(name = "vType_idx_1")
              @Column(name = "vType", nullable = true, unique = false)
              private String vType;
              @Basic
              @Column(name = "vPurpose", nullable = true, unique = false)
              private String vPurpose;
              @Basic
              @Column(name = "vName", nullable = true, unique = false)
              private String vName;
              @Basic
              @Column(name = "vAddress", nullable = true, unique = false)
              private String vAddress;
              @Basic
              @Column(name = "cPerson", nullable = true, unique = false)
              private String cPerson;
              @Basic
              @Column(name = "cAddress", nullable = true, unique = false)
              private String cAddress;
              @Basic
              @Column(name = "timeIn", nullable = false, unique = false)
              private Timestamp timeIn;
              @Basic
              @Column(name = "timeOut", nullable = true, unique = false)
              private Timestamp timeOut;
              @Basic
              @Column(name = "vPhoto", nullable = true, unique = false)
              private Blob vPhoto;
              public Visitor() {
                        super();
              public Long getVisitorId() {
                        return visitorId;
              public void setVisitorId(Long visitorId) {
                        this.visitorId = visitorId;
              public String getvType() {
                        return vType;
              public void setvType(String vType) {
                        this.vType = vType;
              public String getvPurpose() {
                        return vPurpose;
              public void setvPurpose(String vPurpose) {
                        this.vPurpose = vPurpose;
              public String getvName() {
                        return vName;
              public void setvName(String vName) {
                        this.vName = vName;
              public String getvAddress() {
                        return vAddress;
              public void setvAddress(String vAddress) {
                        this.vAddress = vAddress;
              public String getcPerson() {
                        return cPerson;
              public void setcPerson(String cPerson) {
                        this.cPerson = cPerson;
              public String getcAddress() {
                        return cAddress;
              public void setcAddress(String cAddress) {
                        this.cAddress = cAddress;
              public Timestamp getTimeIn() {
                        return timeIn;
              public void setTimeIn(Timestamp timeIn) {
                        this.timeIn = timeIn;
              public Timestamp getTimeOut() {
                        return timeOut;
              public void setTimeOut(Timestamp timeOut) {
                        this.timeOut = timeOut;
              public Blob getvPhoto() {
                        return vPhoto;
              public void setvPhoto(Blob vPhoto) {
                        this.vPhoto = vPhoto;
    VisitorService.java
    package com.visitor;
    import java.sql.Timestamp;
    import java.util.Date;
    import java.util.List;
    import javax.persistence.EntityManager;
    import javax.persistence.EntityManagerFactory;
    import javax.persistence.EntityTransaction;
    import javax.persistence.Persistence;
    import javax.persistence.Query;
    import org.apache.log4j.Logger;
    public class VisitorService {
              private static final String PERSISTENCE_UNIT = "visitor_db";
              private static Logger logger = Logger.getLogger(VisitorService.class);
              public VisitorService() {
                        super();
              public List<Visitor> getvisitors() {
                        logger.debug("** getVisitors called...");
                        EntityManagerFactory entityManagerFactory = Persistence
                                            .createEntityManagerFactory(PERSISTENCE_UNIT);
                        EntityManager em = entityManagerFactory.createEntityManager();
                        Query findAllQuery = em.createNamedQuery("visitors.findAll");
                        List<Visitor> visitors = findAllQuery.getResultList();
                        if (visitors != null)
                                  logger.debug("** Found " + visitors.size() + " records:");
                        return visitors;
              public void addUpdateVisitor(Visitor visitor) throws Exception {
                        logger.debug("** addUpdateVisitor called...");
                        EntityManagerFactory emf = Persistence
                                            .createEntityManagerFactory(PERSISTENCE_UNIT);
                        EntityManager em = emf.createEntityManager();
                        // When passing Boolean and Number values from the Flash client to a
                        // Java object, Java interprets null values as the default values for
                        // primitive types; for example, 0 for double, float, long, int, short,
                        // byte.
                        if (visitor.getVisitorId() == null          || visitor.getVisitorId() == 0) {
                                  // New consultant is created
                                  visitor.setVisitorId(null);
                                  visitor.setTimeIn(new Timestamp(new Date().getTime()));
                        } else {
                                  visitor.setTimeOut(new Timestamp(new Date().getTime()));
                                  // Existing consultant is updated - do nothing.
                        EntityTransaction tx = em.getTransaction();
                        tx.begin();
                        try {
                                  em.merge(visitor);
                                  tx.commit();
                        } catch (Exception e) {
                                  logger.error("** Error: " + e.getMessage());
                                  tx.rollback();
                                  throw new Exception(e.getMessage());
                        } finally {
                                  logger.info("** Closing Entity Manager.");
                                  em.close();
              public void deleteVisitor(Long visitorId) {
                        logger.debug("** deleteVisitor called...");
                        EntityManagerFactory emf = Persistence
                                            .createEntityManagerFactory(PERSISTENCE_UNIT);
                        EntityManager em = emf.createEntityManager();
                        Query q = em.createNamedQuery("visitors.byId");
                        q.setParameter("visitorId", visitorId);
                        Visitor visitor = (Visitor) q.getSingleResult();
                        if (visitor != null) {
                                  EntityTransaction tx = em.getTransaction();
                                  tx.begin();
                                  try {
                                            em.remove(visitor);
                                            tx.commit();
                                  } catch (Exception e) {
                                            logger.error("** Error: " + e.getMessage());
                                            tx.rollback();
                                  } finally {
                                            logger.info("** Closing Entity Manager.");
                                            em.close();
    remoting-config.xml
    <?xml version="1.0" encoding="UTF-8"?>
    <service id="remoting-service" class="flex.messaging.services.RemotingService">
              <adapters>
                        <adapter-definition id="java-object"
                                  class="flex.messaging.services.remoting.adapters.JavaAdapter"
                                  default="true" />
              </adapters>
              <default-channels>
                        <channel ref="my-amf" />
              </default-channels>
              <!-- ADC Demo application -->
              <destination id="visitorService">
                        <properties>
                                  <source>com.visitor.VisitorService</source>
                        </properties>
              </destination>
    </service>

    Hi!
    I am using Flash Builder 4.6, BlazeDS, and Hibernate. How to store a webcam snapshot into the MySql Database. I stored Form Items by using RemoteObject into the database. But I failed to store webcam snapshot. I captured that image on Panel component.I converted that image to ByteArray. Now I want to save that image into the database. Please help me in this regard.
    thanks in advance.
    Here the Code:
    VisitorEntryForm.mxml
    <?xml version="1.0" encoding="utf-8"?>
    <mx:TitleWindow
              xmlns:mx="http://www.adobe.com/2006/mxml"
              xmlns:vo="com.visitor.vo.*"
              width="600"
              height="300"
              defaultButton="{submitButton}"
              showCloseButton="true"
              creationComplete="creationCompleteHandler();"
              close="PopUpManager.removePopUp(this);"
              title="Visitor Entry Form" xmlns:text="flash.text.*">
              <mx:RemoteObject id="saveService" destination="visitorService" result="handleSaveResult(event)" fault="handleFault(event)" showBusyCursor="true" />
              <vo:Visitor id="visitor"
                                               vType="{vTypeField.text}"
                                               vPurpose="{vPurposeField.text}"
                                               vName="{vNameField.text}"
                                               vAddress="{vAddressField.text}"
                                               cPerson="{cPersonField.text}"
                                               cAddress="{cAddressField.text}"
                                     />
                        <mx:Script>
                        <![CDATA[
                        import mx.managers.PopUpManager;
                        import flash.media.Camera;
                        import com.visitor.vo.WebCam;
                        import com.visitor.vo.Base64;
                        import mx.core.UIComponent;
                        import mx.graphics.codec.JPEGEncoder;
                        import mx.controls.Alert;
                        import mx.containers.Canvas;
                        import mx.rpc.events.ResultEvent;
                        import mx.rpc.events.FaultEvent;
                        import mx.events.ValidationResultEvent;
                        import mx.validators.Validator;
                                  [Bindable]
                                  private var webCam: com.visitor.vo.WebCam;
                                  [Bindable]
                                  private var message:String;
                                  [Bindable]
                                  private var formIsValid:Boolean = false;
                                  [Bindable]
                                  public var formIsEmpty:Boolean;
                                  private var focussedFormControl:DisplayObject;
                                  private function handleSaveResult(ev:ResultEvent):void {
                                            clearFormHandler();
                                            validateForm(ev);
                                            Alert.show("Visitor successfully created/updated.", "Information", Alert.OK, null, null, null, Alert.OK);
                                            // Reload the list.
                                            parentApplication.listConsultants.loaderService.getConsultants();
                                            PopUpManager.removePopUp(this);
                                  private function handleFault(ev:FaultEvent):void {
                                            message = "Error: " + ev.fault.faultCode + " \n "
                                                      + "Detail: " + ev.fault.faultDetail + " \n "
                                                      + "Message: " + ev.fault.faultString;
                                  public function saveVisitor():void {
                                            saveService.addUpdateVisitor(visitor);
                                  private function creationCompleteHandler():void {
                                            init();
                                            PopUpManager.centerPopUp(this);
                                            resetFocus();
                                  private function resetFocus():void {
                                            focusManager.setFocus(vTypeField);
                                  public function validateForm(event:Event):void  {
                                            focussedFormControl = event.target as DisplayObject;   
                                            formIsValid = true;
                                            // Check if form is empty
                                            formIsEmpty = (vTypeField.text == "" && vPurposeField.text == "" && vNameField.text == "" && vAddressField.text == "" && cPersonField.text == "" && cAddressField.text == "");
                                            validate(vTypeValidator);               
                                            validate(vPurposeValidator);
                                            validate(vNameValidator);
                                            validate(vAddressValidator);
                                            validate(cPersonValidator);
                                            validate(cAddressValidator);
                                  private function validate(validator:Validator):Boolean {
                                            var validatorSource:DisplayObject = validator.source as DisplayObject;
                                            var suppressEvents:Boolean = (validatorSource != focussedFormControl);
                                            var event:ValidationResultEvent = validator.validate(null, suppressEvents);
                                            var currentControlIsValid:Boolean = (event.type == ValidationResultEvent.VALID);
                                            formIsValid = formIsValid && currentControlIsValid;
                                            return currentControlIsValid;
                                  private function clearFormHandler():void {
                                            // Clear all input fields.
                                            vTypeField.text = "";
                                            vPurposeField.text = "";
                                            vNameField.text = "";
                                            vAddressField.text = "";
                                            cPersonField.text = "";
                                            cAddressField.text = "";
                                            message = "";
                                            // Clear validation error messages.
                                            vTypeField.errorString = "";
                                            vPurposeField.errorString = "";
                                            vNameField.errorString = "";
                                            vAddressField.errorString = "";
                                            cPersonField.errorString = "";
                                            cAddressField.errorString = "";
                                            formIsEmpty = true;
                                            formIsValid = false;
                                            resetFocus();
                                  private function init():void {
                                  webCam = new WebCam(97,97);
                                  var ref:UIComponent = new UIComponent();
                                  preview.removeAllChildren();
                                  preview.addChild(ref);
                                  ref.addChild(webCam);
                                  private function takeSnapshot():void {
                                  imageViewer.visible = true;
                                  imageViewer.width = preview.width;
                                  imageViewer.height = preview.height;
                                  var uiComponent : UIComponent = new UIComponent();
                                  uiComponent.width = webCam.width;
                                  uiComponent.height = webCam.height;
                                  var photoData:Bitmap = webCam.getSnapshot();
                                  var photoBitmap:BitmapData = photoData.bitmapData;
                                  uiComponent.addChild(photoData);
                                  imageViewer.removeAllChildren();
                                  imageViewer.addChild(uiComponent);
                                  private function uploadSnapshot():void
                                            if (imageViewer.getChildren().length > 0)
                                                      var uic:UIComponent = imageViewer.getChildAt(0) as UIComponent;
                                                      var bitmap:Bitmap = uic.getChildAt(0) as Bitmap;
                                                      var jpgEncoder:JPEGEncoder = new JPEGEncoder(75);
                                                      var jpgBytes:ByteArray = jpgEncoder.encode(bitmap.bitmapData);
                                  private function deleteSnapshot():void
                                            imageViewer.removeAllChildren();
                        ]]>
                        </mx:Script>
              <mx:StringValidator id="vTypeValidator"          source="{vTypeField}"          property="text" minLength="2" required="true" />
              <mx:StringValidator id="vPurposeValidator" source="{vPurposeField}"          property="text" minLength="2" required="true" />
              <mx:StringValidator id="vNameValidator"          source="{vNameField}"          property="text" minLength="2" required="true" />
              <mx:StringValidator id="vAddressValidator"          source="{vAddressField}"          property="text" minLength="5" required="true" />
              <mx:StringValidator id="cPersonValidator" source="{cPersonField}"          property="text" minLength="2" required="true" />
              <mx:StringValidator id="cAddressValidator"          source="{cAddressField}"          property="text" minLength="5" required="true" />
              <mx:Grid width="575" height="211">
                        <mx:GridRow width="575" height="211">
                                  <mx:GridItem width="301" height="235">
                                            <mx:Form width="301" height="208">
                                                      <mx:FormItem label="Visitor's Type">
                                                                <mx:ComboBox id="vTypeField" text="{visitor.vType}" change="validateForm(event);" editable="true">
                                                                          <mx:Array>
                                                                                    <mx:String></mx:String>
                                                                                    <mx:String>Contractor</mx:String>
                                                                                    <mx:String>Supplier</mx:String>
                                                                                    <mx:String>Transporter</mx:String>
                                                                                    <mx:String>Plant</mx:String>
                                                                                    <mx:String>Non-Plant</mx:String>
                                                                          </mx:Array>
                                                                </mx:ComboBox>
                                                      </mx:FormItem>
                                                      <mx:FormItem label="Visit Purpose">
                                                                <mx:ComboBox id="vPurposeField" text="{visitor.vPurpose}" change="validateForm(event);" editable="true">
                                                                          <mx:Array>
                                                                                    <mx:String></mx:String>
                                                                                    <mx:String>Official</mx:String>
                                                                                    <mx:String>Personal</mx:String>
                                                                          </mx:Array>
                                                                </mx:ComboBox>
                                                      </mx:FormItem>
                                                      <mx:FormItem label="Visitor's Name">
                                                                <mx:TextInput id="vNameField"  text="{visitor.vName}" change="validateForm(event);"/>
                                                      </mx:FormItem>
                                                      <mx:FormItem label="Address">
                                                                <mx:TextInput id="vAddressField"   text="{visitor.vAddress}" change="validateForm(event);"/>
                                                      </mx:FormItem>
                                                      <mx:FormItem label="Contact Person">
                                                                <mx:TextInput id="cPersonField"  text="{visitor.cPerson}" change="validateForm(event);"/>
                                                      </mx:FormItem>
                                                      <mx:FormItem label="Address">
                                                                <mx:TextInput id="cAddressField"  text="{visitor.cAddress}" change="validateForm(event);"/>
                                                      </mx:FormItem>
                                                      </mx:Form>
                                  </mx:GridItem>
                                  <mx:GridItem width="264" height="193">
                                            <mx:Grid width="241" height="206">
                                                      <mx:GridRow width="100%" height="100%">
                                                                <mx:GridItem width="100%" height="100%" horizontalAlign="center" verticalAlign="middle">
                                                                          <mx:Panel width="100" height="132" title="Snap" id="preview" layout="absolute"/>
                                                                </mx:GridItem>
                                                                <mx:GridItem width="100%" height="100%" horizontalAlign="center" verticalAlign="middle">
                                                                          <mx:Panel width="100" height="132" title="Preview" id="imageViewer"  layout="absolute"/>
                                                                </mx:GridItem>
                                                      </mx:GridRow>
                                                      <mx:GridRow width="100%" height="27" >
                                                                <mx:GridItem width="100%" height="100%" horizontalAlign="center">
                                                                          <mx:Button id="snapshot" x="2" width="106" height="27" label="Snap"
                                                                                                  click="takeSnapshot();"/>
                                                                </mx:GridItem>
                                                                <mx:GridItem width="100%" height="100%" horizontalAlign="center">
                                                                          <mx:Button id="deleteButton" x="1" width="106" height="27" label="Delete"
                                                                                                  click="deleteSnapshot();"/>
                                                                </mx:GridItem>
                                                      </mx:GridRow>
                                            </mx:Grid>
                                  </mx:GridItem>
                        </mx:GridRow>
              </mx:Grid>
              <mx:ControlBar height="40" horizontalAlign="center">
                        <mx:Button label="Save Visitor"          id="submitButton" enabled="{formIsValid}" click="saveVisitor();" />
                        <mx:Button label="Clear form" enabled="{!formIsEmpty}"          click="clearFormHandler();" />
                        <mx:Button label="Cancel" click="PopUpManager.removePopUp(this);"/>
                        <mx:Label width="211" id="state"/>
              </mx:ControlBar>
              <mx:Text text="{message}" fontWeight="bold" width="300"/>
    </mx:TitleWindow>
    ListVisitors.mxml
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Panel
              xmlns:mx="http://www.adobe.com/2006/mxml"
              xmlns:view="com.visitor.view.*"
              width="100%"
              height="100%"
              title="Visitor Management System - Found {visitorRecords} visitors."
              creationComplete="loadVisitors();">
              <mx:RemoteObject id="loaderService" destination="visitorService" result="handleLoadResult(event)"          fault="handleFault(event)" showBusyCursor="true" />
              <mx:RemoteObject id="deleteService" destination="visitorService" result="handleDeleteResult(event)"          fault="handleFault(event)" showBusyCursor="true" />
              <mx:Script>
                        <![CDATA[
                                  import com.visitor.vo.Visitor;
                                  import mx.controls.Alert;
                                  import mx.managers.PopUpManager;
                                  import mx.containers.TitleWindow;
                                  import mx.collections.ArrayCollection;
                                  import mx.rpc.events.ResultEvent;
                                  import mx.rpc.events.FaultEvent;
                                  [Bindable]
                                  private var message:String;
                                  [Bindable]
                                  private var visitors:ArrayCollection = new ArrayCollection();
                                  [Bindable]
                                  private var visitorRecords:int = 0;
                                  public function loadVisitors():void {
                                            loaderService.getVisitors();
                                  private function deleteVisitor():void {
                                            if(dataGrid.selectedItem != null) {
                                                      var selectedItem:Visitor = dataGrid.selectedItem as Visitor;
                                                      deleteService.deleteVisitor(selectedItem.visitorId);
                                  private function createVisitor():void {
                                            var titleWindow:VisitorEntryForm = VisitorEntryForm(PopUpManager.createPopUp(this, VisitorEntryForm, true));
                                            titleWindow.setStyle("borderAlpha", 0.9);
                                            titleWindow.formIsEmpty = true;
                                  private function updateVisitor():void {
                                            var titleWindow:VisitorEntryForm = VisitorEntryForm(PopUpManager.createPopUp(this, VisitorEntryForm, true));
                                            titleWindow.setStyle("borderAlpha", 0.9);
                                            titleWindow.visitor = dataGrid.selectedItem as Visitor;
                                            titleWindow.formIsEmpty = false;
                                  private function handleLoadResult(ev:ResultEvent):void {
                                            visitors = ev.result as ArrayCollection;
                                            visitorRecords = visitors.length;
                                  private function handleDeleteResult(ev:ResultEvent):void {
                                            Alert.show("The visitor has been deleted.", "Information", Alert.OK, null, null, null, Alert.OK);
                                            loadVisitors();
                                  private function handleFault(ev:FaultEvent):void {
                                            message = "Error: "
                                                      + ev.fault.faultCode + " - "
                                                      + ev.fault.faultDetail + " - "
                                                      + ev.fault.faultString;
                        ]]>
              </mx:Script>
              <mx:VBox width="100%" height="100%">
                        <mx:Label text="{message}" fontWeight="bold" includeInLayout="false" />
                        <mx:DataGrid
                                  id="dataGrid"
                                  width="100%"
                                  height="100%"
                                  dataProvider="{visitors}"
                                  doubleClickEnabled="true"
                                  doubleClick="updateVisitor()" >
                                  <mx:columns>
                                            <mx:DataGridColumn dataField="visitorId"          headerText="Visitor ID" width="100"/>
                                            <mx:DataGridColumn dataField="vType"                    headerText="Visitor's Type" />
                                            <mx:DataGridColumn dataField="vPurpose"           headerText="Visit Purpose" />
                                            <mx:DataGridColumn dataField="vName"                     headerText="Visitor's Name" />
                                            <mx:DataGridColumn dataField="vAddress"                    headerText="Visitor's Address" />
                                            <mx:DataGridColumn dataField="cPerson"                     headerText="Contact Person" />
                                            <mx:DataGridColumn dataField="cAddress"                    headerText="Contact Address" />
                                            <mx:DataGridColumn dataField="timeIn"                     headerText="Time-In" />
                                            <mx:DataGridColumn dataField="timeOut"                     headerText="Time-Out" />
                                            <mx:DataGridColumn dataField="vPhoto"                     headerText="Visitor's Photo" />
                                  </mx:columns>
                        </mx:DataGrid>
                        <mx:ControlBar horizontalAlign="center">
                                  <mx:Button label="Create Visitor"          click="createVisitor()"          toolTip="Create a new visitor and store it in the database." />
                                  <mx:Button label="Update Visitor"          click="updateVisitor()"           enabled="{dataGrid.selectedItem}" toolTip="Update an existing database visitor." />
                                  <mx:Button label="Delete Visitor"          click="deleteVisitor()"          enabled="{dataGrid.selectedItem}" toolTip="Delete the visitor from the database." />
                                  <mx:Button label="Reload Data"                    click="loadVisitors()"           toolTip="Reload the visitor list from the database." />
                        </mx:ControlBar>
              </mx:VBox>
    </mx:Panel>
    Visitor.as
    package com.visitor.vo
              import mx.controls.Image;
              import spark.primitives.BitmapImage;
              [Bindable]
              [RemoteClass(alias="com.visitor.Visitor")]
              public class Visitor
                        public function Visitor()
                        public var visitorId:Number;
                        public var vType:String;
                        public var vPurpose:String;
                        public var vName:String;
                        public var vAddress:String;
                        public var cPerson:String;
                        public var cAddress:String;
                        public var timeIn:Date;
                        public var timeOut:Date;
                       public var vPhoto: Image;
    Visitor.java
    package com.visitor;
    import java.sql.Blob;
    import java.sql.Timestamp;
    import javax.persistence.Basic;
    import javax.persistence.Column;
    import javax.persistence.Entity;
    import javax.persistence.GeneratedValue;
    import javax.persistence.GenerationType;
    import javax.persistence.Id;
    import javax.persistence.NamedQueries;
    import javax.persistence.NamedQuery;
    import javax.persistence.Table;
    import org.hibernate.annotations.Index;
    @Entity
    @Table(name = "visitors")
    @NamedQueries( {
                        @NamedQuery(name = "visitors.findAll", query = "from Visitor"),
                        @NamedQuery(name = "visitors.byId", query = "select v from Visitor v where v.visitorId= :visitorId") })
    public class Visitor {
              @Id
              @GeneratedValue(strategy = GenerationType.AUTO)
              @Column(name = "visitorId", nullable = false)
              private Long visitorId;
              @Basic
              @Index(name = "vType_idx_1")
              @Column(name = "vType", nullable = true, unique = false)
              private String vType;
              @Basic
              @Column(name = "vPurpose", nullable = true, unique = false)
              private String vPurpose;
              @Basic
              @Column(name = "vName", nullable = true, unique = false)
              private String vName;
              @Basic
              @Column(name = "vAddress", nullable = true, unique = false)
              private String vAddress;
              @Basic
              @Column(name = "cPerson", nullable = true, unique = false)
              private String cPerson;
              @Basic
              @Column(name = "cAddress", nullable = true, unique = false)
              private String cAddress;
              @Basic
              @Column(name = "timeIn", nullable = false, unique = false)
              private Timestamp timeIn;
              @Basic
              @Column(name = "timeOut", nullable = true, unique = false)
              private Timestamp timeOut;
              @Basic
              @Column(name = "vPhoto", nullable = true, unique = false)
              private Blob vPhoto;
              public Visitor() {
                        super();
              public Long getVisitorId() {
                        return visitorId;
              public void setVisitorId(Long visitorId) {
                        this.visitorId = visitorId;
              public String getvType() {
                        return vType;
              public void setvType(String vType) {
                        this.vType = vType;
              public String getvPurpose() {
                        return vPurpose;
              public void setvPurpose(String vPurpose) {
                        this.vPurpose = vPurpose;
              public String getvName() {
                        return vName;
              public void setvName(String vName) {
                        this.vName = vName;
              public String getvAddress() {
                        return vAddress;
              public void setvAddress(String vAddress) {
                        this.vAddress = vAddress;
              public String getcPerson() {
                        return cPerson;
              public void setcPerson(String cPerson) {
                        this.cPerson = cPerson;
              public String getcAddress() {
                        return cAddress;
              public void setcAddress(String cAddress) {
                        this.cAddress = cAddress;
              public Timestamp getTimeIn() {
                        return timeIn;
              public void setTimeIn(Timestamp timeIn) {
                        this.timeIn = timeIn;
              public Timestamp getTimeOut() {
                        return timeOut;
              public void setTimeOut(Timestamp timeOut) {
                        this.timeOut = timeOut;
              public Blob getvPhoto() {
                        return vPhoto;
              public void setvPhoto(Blob vPhoto) {
                        this.vPhoto = vPhoto;
    VisitorService.java
    package com.visitor;
    import java.sql.Timestamp;
    import java.util.Date;
    import java.util.List;
    import javax.persistence.EntityManager;
    import javax.persistence.EntityManagerFactory;
    import javax.persistence.EntityTransaction;
    import javax.persistence.Persistence;
    import javax.persistence.Query;
    import org.apache.log4j.Logger;
    public class VisitorService {
              private static final String PERSISTENCE_UNIT = "visitor_db";
              private static Logger logger = Logger.getLogger(VisitorService.class);
              public VisitorService() {
                        super();
              public List<Visitor> getvisitors() {
                        logger.debug("** getVisitors called...");
                        EntityManagerFactory entityManagerFactory = Persistence
                                            .createEntityManagerFactory(PERSISTENCE_UNIT);
                        EntityManager em = entityManagerFactory.createEntityManager();
                        Query findAllQuery = em.createNamedQuery("visitors.findAll");
                        List<Visitor> visitors = findAllQuery.getResultList();
                        if (visitors != null)
                                  logger.debug("** Found " + visitors.size() + " records:");
                        return visitors;
              public void addUpdateVisitor(Visitor visitor) throws Exception {
                        logger.debug("** addUpdateVisitor called...");
                        EntityManagerFactory emf = Persistence
                                            .createEntityManagerFactory(PERSISTENCE_UNIT);
                        EntityManager em = emf.createEntityManager();
                        // When passing Boolean and Number values from the Flash client to a
                        // Java object, Java interprets null values as the default values for
                        // primitive types; for example, 0 for double, float, long, int, short,
                        // byte.
                        if (visitor.getVisitorId() == null          || visitor.getVisitorId() == 0) {
                                  // New consultant is created
                                  visitor.setVisitorId(null);
                                  visitor.setTimeIn(new Timestamp(new Date().getTime()));
                        } else {
                                  visitor.setTimeOut(new Timestamp(new Date().getTime()));
                                  // Existing consultant is updated - do nothing.
                        EntityTransaction tx = em.getTransaction();
                        tx.begin();
                        try {
                                  em.merge(visitor);
                                  tx.commit();
                        } catch (Exception e) {
                                  logger.error("** Error: " + e.getMessage());
                                  tx.rollback();
                                  throw new Exception(e.getMessage());
                        } finally {
                                  logger.info("** Closing Entity Manager.");
                                  em.close();
              public void deleteVisitor(Long visitorId) {
                        logger.debug("** deleteVisitor called...");
                        EntityManagerFactory emf = Persistence
                                            .createEntityManagerFactory(PERSISTENCE_UNIT);
                        EntityManager em = emf.createEntityManager();
                        Query q = em.createNamedQuery("visitors.byId");
                        q.setParameter("visitorId", visitorId);
                        Visitor visitor = (Visitor) q.getSingleResult();
                        if (visitor != null) {
                                  EntityTransaction tx = em.getTransaction();
                                  tx.begin();
                                  try {
                                            em.remove(visitor);
                                            tx.commit();
                                  } catch (Exception e) {
                                            logger.error("** Error: " + e.getMessage());
                                            tx.rollback();
                                  } finally {
                                            logger.info("** Closing Entity Manager.");
                                            em.close();
    remoting-config.xml
    <?xml version="1.0" encoding="UTF-8"?>
    <service id="remoting-service" class="flex.messaging.services.RemotingService">
              <adapters>
                        <adapter-definition id="java-object"
                                  class="flex.messaging.services.remoting.adapters.JavaAdapter"
                                  default="true" />
              </adapters>
              <default-channels>
                        <channel ref="my-amf" />
              </default-channels>
              <!-- ADC Demo application -->
              <destination id="visitorService">
                        <properties>
                                  <source>com.visitor.VisitorService</source>
                        </properties>
              </destination>
    </service>

  • Hello apple guys, i can't open app store, reminders, contacts, mail(crash), maps, Image Capture, and other apps that comes with Mavericks OS, how i can solve this problem?

    hello apple guys, after installing OS X Mavericks, i can't open app store, reminders, contacts, mail(crash), maps, Image Capture, and other apps that comes with Mavericks OS, how i can solve this problem?

    So is this the way Apple works now? Not solving customers problems? I'm sure so many users have had this problem. I've had, and I reinstalled Mavericks 3 times. Works fine for some days and then several Apple Apps stop working. Is that a way to force us ti update to Yosemite? (I don't want to) and then pay to update some third party programs (i.e. Pro Tools). Also, there are so many 15" MacBooks Pro with graphic problems and of course the guys at the Apple Service Centers always say: "It's the logic board, you can have it replaced, but it's so expensive I would recommend a new Mac".  I really, really miss Steve Jobs!

  • How to store photo images in a database table?

    Hello Y'all,
    How do I store about 695 signs inventory photo images from a PDF file to an Oracle database table? We are using Oracle 10.2.0.2. What data type should I use for these images? How about the table space? What table space should I allocate to ensure there is no space issue?
    Thanks in advance for any/all the help.

    Here you go..
    Assuming you have a table
    test_blob (col1 BLOB);
    Create an oracle directory or use an existing one to place the image on the oracle server.
    create or replace directory tmp_blob as '/tmp';This tmp location should exist on your server where oracle is installed.
    also ftp the image file (say image1.bmp) to this location
    declare
    l_blob BLOB;
    l_bfle BFILE;
    l_re BOOLEAN := FALSE;
    Begin
    DBMS_LOB.createtemporary(l_blob, TRUE);
    insert into test_blob(col1) values (EMPTY_BLOB())
    returning col1 into l_blob;
    --return image into l_blob;
    l_bfile := BFILENAME('TMP_BLOB','image1.bmp');
    --check if file exists
    l_ret := DBMS_LOB.fileexists (l_bfile) = 1;
    if (l_ret)
    then
    DBMS_LOB.fileopen(l_bfile);
    DBMS_LOB.loadfromfile(l_blob, l_bfile, DBMS_LOB.getlength(l_bfile));
    commit;
    else
    DBMS_OUTPUT.put_line('File not present');
    end if;
    end;
    / not tested this exact one.. check for the syntax errors if any.. this should work

  • How to store the images in Oracle?

    Hi,
    I am a new developer, trying to find out how to store the images in Oracle. Is there anyway that I can store the images in Oracle and insert them into my html file?
    Thanks!
    Sarah

    There is a simple image example available from OTN.
    From the OTN main page, go to Products --> interMedia --> Sample Code. The name of the example is "Load rich media content with a browser."
    This example loads and retrieves an image from an Oracle8i database through a web page using the Oracle interMedia Web Agent.
    Hope this helps.
    null

  • How to store jpeg images in SQL server using NI database Connectivity Toolset. Can anyone please help me in this regard.

    Please tell how to store jpeg images in SQL Server using NI Database Connectivity Toolset.

    http://www.w3schools.com/sql/sql_datatypes.asp
    You setup a field as BLOB and store the binary of the picture there. Depending on the database it can be called differently as you can see in the link, in SQL server there's even a Image datatype.
    /Y
    LabVIEW 8.2 - 2014
    "Only dead fish swim downstream" - "My life for Kudos!" - "Dumb people repeat old mistakes - smart ones create new ones."
    G# - Free award winning reference based OOP for LV

  • How to store the images in tables

    how to store the images in tables .what is the use of "clob ,blob"

    Using with the CLOB or BLOB, you can store the images in the table.
    Srini C

  • How to store image in the oracle database 10.2. using File Maker 10.

    Hi.,
    I want to store image, media file in the oracle database using File Maker as a front end.
    I connect Oracle using odbc from file maker. There are table and in that table there a column "pict" of blob type. but this column is not showing in the file maker.
    2. Here I can not change the data type of any column.
    Now how to store images in the oracle table using odbc or any other tool.
    Regards,
    Shyam

    I wrote an example for my students, you can find it here. It's using PHP as the front end but all you need to do is know how and leverage the stored procedures. All code is downloadable in zip files from the blog.
    http://blog.mclaughlinsoftware.com/php-programming/oracle-lob-processing/

  • How to store images in database

    Can anyone help me with storing images in database, problem with me is that i m designing a site in which u need to display product information and administrator can add and delete products. now how can i make that administrator can add a image to database, Can u tell me that can image itself can be stored in a database or just the path of it can be stored in a database.
    Waiting for quick reply,
    thanks

    can u plss tell me how to store the path of the image in database , do we just have to mention it as varchar field and write the path thats it or do we have to do anything else . and pls also tellme when do we have to set connections ? only at the time to retrieving the images since we are not uploading the image sin DB just mentioning their path . pls reply ASAP

  • How to store images in database and retrieve them back to page?

    Well I don't know how to store an image file to a database (say MSSQL) from the JSP and retrieve it back whenever needed and put it on the JSP page? Please help me.

    I am not sure how to store images in database but what you can do is store the image into particular folder using FileOutputStream and its unique name into the database...and than retrieve it from the folder using that name retrieved from database...
    <%
    response.setContentType("text/html");
    response.setHeader("Cache-control","no-cache");
    String err = "";
    String lastFileName = "";
    String contentType = request.getContentType();
    String boundary = "";
    final int BOUNDARY_WORD_SIZE = "boundary=".length();
    System.out.println("contentType --> "+contentType);
    System.out.println("BOUNDARY_WORD_SIZE --> "+BOUNDARY_WORD_SIZE);
    if(contentType == null || !contentType.startsWith("multipart/form-data"))
    err = "Ilegal ENCTYPE : must be multipart/form-data\n";
    err += "ENCTYPE set = " + contentType;
    else
    boundary = contentType.substring(contentType.indexOf("boundary=") + BOUNDARY_WORD_SIZE);
    System.out.println("boundary --> "+boundary);
    boundary = "--" + boundary;
    try
    ServletInputStream sis = request.getInputStream();
    byte[] b = new byte[1024];
    int x=0;
    int state=0;
    String name=null,fileName=null,contentType2=null;
    java.io.FileOutputStream buffer = null;
    while((x=sis.readLine(b,0,1024))>-1)
         System.out.println("************ x ********** "+x);
         String s = new String(b,0,x);
                   System.out.println("************ s ********** \n"+s);
         if(s.startsWith(boundary))
         state = 0;
         System.out.println("name="+name);
         System.out.println("filename="+fileName);
         name = null;
         contentType2 = null;
         fileName = null;
         else if(s.startsWith("Content-Disposition") && state==0)
              System.out.println("-- 1 --");
              state = 1;
              System.out.println("s.indexOf(filename=) --> "+s.indexOf("filename="));
              if(s.indexOf("filename=") == -1)
                   name = s.substring(s.indexOf("name=") + "name=".length(),s.length()-2);
                   System.out.println("after name substring 1 "+name);
              else
                   name = s.substring(s.indexOf("name=") + "name=".length(),s.lastIndexOf(";"));
                   System.out.println("after name substring 2 "+name);
                   fileName = s.substring(s.indexOf("filename=") + "filename=".length(),s.length()-2);
                   System.out.println("fileName --> "+fileName);
                   //String fileName1 = s.substring(s.indexOf("filename=") + "filename=".length(),s.length());
                   //System.out.println("fileName1 -->"+fileName1);
                   if(fileName.equals("\"\""))
                   fileName = null;
                   else
                        String userAgent = request.getHeader("User-Agent");
                        System.out.println("userAgent --> "+userAgent);
                        String userSeparator="/"; // default
                        if (userAgent.indexOf("Windows")!=-1)
                        System.out.println("test --> "+"\\");
                        userSeparator="\\";
                        if (userAgent.indexOf("Linux")!=-1)
                        userSeparator="/";
                        System.out.println("userSeparator "+userSeparator);
                        System.out.println("fileName before inserting userSeparators "+fileName);
                        fileName = fileName.substring(fileName.lastIndexOf(userSeparator)+1,fileName.length()-1);
                        System.out.println("fileName after userSeparators "+fileName);
                        if(fileName.startsWith( "\""))
                        fileName = fileName.substring( 1);
              name = name.substring(1,name.length()-1);
              System.out.println("name 2 --> "+name);
              System.out.println("final file name "+fileName);
              if (name.equals("file"))
                   if (buffer!=null)
                   buffer.close();
                   lastFileName = fileName;
                   buffer = new java.io.FileOutputStream("/Documents and Settings/sunil/Desktop/images/"+fileName);
         else if(s.startsWith("Content-Type") && state==1)
                             System.out.println("-- 2 --");
              state = 2;
              contentType2 = s.substring(s.indexOf(":")+2,s.length()-2);
              System.out.println("contentType2 --> "+contentType2);
         else if(s.equals("\r\n") && state != 3)
                   System.out.println("-- 3 --");
              state = 3;
         else
              System.out.println("-- 4 --");     
              if (name.equals("file"))
              System.out.println("Final x :: "+x);     
              buffer.write(b,0,x);
    }     // while closing
    sis.close();
    buffer.close();
    }catch(java.io.IOException e)
    err = e.toString();
    boolean ok = err.equals("");
    if(!ok)
    out.println(err);
    else
    %>
              <SCRIPT language="javascript">
              history.back(1);
              alert('Uploaded <%=lastFileName%>');
              window.location.reload(false);
              </SCRIPT>
    <%
         out.println("done");
    %>
    </BODY>
    </HTML>
    I think it will solve ur problem..

  • How to store images in MAX DB

    hi,
    can u pls tell how to store images in MAXDB using java.......
    regards
    Guru

    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/f5d3c40a-0801-0010-55b7-9e3b01745a40

  • How to store images in access

    please tell me how to store images in access

    The JDBC-ODBC Bridge?
    Or, better yet, a Google (or whatever engine) search for a real JDBC Driver for access (I do believe at least one exists).
    The JDBC tutorials and, maybe, a little Google (or whatever engine) searching for examples, should provide more than enough to get started.
    Once you have something, and it still has a problem, post it, along with a complete, and concise, description of the problem, along with all error messages, and we will help you further.

Maybe you are looking for