4 Replies Latest reply on Aug 24, 2006 1:35 PM by seth_hodgson

    How to use FDS with Oracle DB?? JavaAdapter?

    kedward
      Hello,

      Can anyone explain to me in plain english how my Flex application uses FDS to connect to an oracle database?

      Ok, so the mxml/swf calls the dataservice.... WHERE is the dataservice? WHAT is the dataservice (functionaly a servlet?)?? HOW is the dataservice configured?? Do I use J2ee connection pools?

      Where are the detailed instructions for connecting my FDS flex application to a backend oracle database?!?!?!

      Ed

        • 1. Re: How to use FDS with Oracle DB?? JavaAdapter?
          kedward Level 1
          Hello,

          OK, from reading the HORRIBLE adobe doc's on data services, I am thinking that I just need to alter the below files.... but it still doesn't work. I get a "No destination 'Employee' exists in service flex.data.DataService" error when running the application...... what am I missing?????:

          1. add call to dataservice in the mxml file:

          <"mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" creationComplete="onCreationComplete()">
          <mx:DataService id="ds" destination="Employee" conflict="logEvent(event)" fault="logEvent(event)" message="logEvent(event)"/>
          <mx:VDividedBox width="800" height="100%">
          <mx:Panel title="Employee::getEmployees()" width="800"

          2. alter the data-management-config.xml to map the data service id to the java class file

          <destination id="Employee">
          <adapter ref="java-dao"/>
          <properties>
          <source>com.theriabook.datasource.EmployeeAssembler</source>
          <scope>application</scope>


          3. The com.theriabook.datasource.EmployeeAssembler java class abstracts the EmployeeDataServiceDAO class which contains the call to the j2ee connection pool:

          conn = JDBCConnection.getConnection("jdbc/theriabook");
          if( logger.isDebugEnabled() ) logger.debug(" SQL: "+sql);
          stmt = conn.prepareStatement(sql);
          • 2. Re: How to use FDS with Oracle DB?? JavaAdapter?
            seth_hodgson Level 1
            Hi Ed,

            FDS is a Java web app that you can think of as having 3 layers:
            1. A set of endpoints that clients connect to in order to send and recieve data and messages. The HTTP and AMF endpoints are implemented as a servlet. The RTMP endpoint is an NIO socket server.
            2. A core message broker that takes inbound messages and routes them to their target service destination and routes responses back out to connected clients.
            3. A service layer with destinations that process these messages from clients and if necessary return a response. Each service exposes specific destinations. In the case of the remoting service each destination is a Java object exposes for RPC, in messaging each destination is a topic to publish to or subscribe to, in the data service each destination is backed by an assembler that manages a specific entity type in your domain model, etc.

            In the data service case you can connect to a database either via the HibernateAssembler or a custom assembler within which you could talk to a DAO layer or manage CRUD ops directly. Your assembler receives change objects for creates, updates, deletes and the way you access your datastore is up to you. The intent of the data service is to act as a layer on top of an existing Java domain model on the server that allows Flash clients to interact with it directly.

            Hopefully that clarrifies the general picture a bit.

            Regarding the error you're hitting, if that's a runtime error being thrown on the client it's because the configuration information compiled into the swf doesn't contain the "Employee" destination you've added. How are you compiling your MXML app? If you're compiling in FlexBuilder or at the command line are you referencing your services-config.xml file using the -services option?

            Best,
            Seth
            • 3. Re: How to use FDS with Oracle DB?? JavaAdapter?
              kedward Level 1
              Thanks,

              What do you mean the configuration information is compilied into the swf? I thought the whole purpose of the config file was that it was kept outside the swf in the data-management-config.xml ?

              Ed
              • 4. Re: How to use FDS with Oracle DB?? JavaAdapter?
                seth_hodgson Level 1
                The configuration files are used for two purposes.

                1. To configure the server portion of FDS
                2. A subset of the configuration data is injected into compiled swfs to allow you to reach destinations on the server over their supported channels/endpoints.

                Taking your example: <mx:DataService id="ds" destination="Employee" ...
                Without injecting some of the configuration info into the swf, there's no way for the DataService component to know how or where to reach the "Employee" destination.

                So you need to compile your swf using the -services compiler option: -services=<path to your services-config.xml file>

                Seth