Saturnboy
 7.15

Getting started with LCDS 3 Beta and MySQL, Part 2

, ,

In Part 1, I covered the basic setup of LiveCycle Data Services 3 Beta sitting on a MySQL database. Now, I’ll get into the Flash Builder side of things, and talk about the Modeler plugin and model driven development.

Setup Modeler Plugin
  1. Get Flash Builder 4 Beta (download)
  2. Get the LCDS Modeler plugin (download)
  3. Install the Modeler plugin:
    • Unzip to a temp folder, which will create a plugins folder
    • Copy the plugins folder’s contents directly into Flash Builder’s plugins folder (typically located in /Applications/Adobe Flash Builder Beta/plugins if you are on a Mac)
    • Restart Flash Builder
Model Driven Development
  1. Create a new Flex project
    • In Flash Builder, right-click and say New > Flex Project
      new flex project
      enlarge
    • Choose J2EE for Application Server Type, and select LCDS
    • Click Next to configure your server
      j2ee server config
      enlarge
    • Uncheck Use Default Location, and fill in your root folder, url, and context (see screenshot)
    • Click Validate Configuration (this will fail if LCDS is not running), and then Finish
  2. Create a new data model
    • Select the Data/Services tab in the bottom window
    • Click the Edit Active Data Model icon in the tab’s menubar (see screenshot)
      new model
      enlarge
    • This will create a new data model for your project, and bring up MyApp.fml in the Modeler’s design view (see screenshot)
    • To see the file in the Package Explorer, click the Filters icon (see screenshot), then uncheck .* and .model
  3. Connect to the server
    • Switch to the Adobe Data Model perspective
    • In the RDS Dataview window, click the RDS Configuration icon
      rds config
      enlarge
    • Set the Context Root to myapp (because our server is running at http://localhost:8080/myapp/)
    • Click Test Connection, and then OK
  4. Verify the server’s connection to MySQL
    • In the RDS Dataview window, expand until we can see our tables
      rds dataview
      enlarge
    • Right-click on a table, and select Show Table Contents
      rds show table
      enlarge
  5. Edit the model
    • Just drag tables from the RDS Dataview to add them to the model
      edit model
      enlarge
  6. Browse the generated services and code
    • Once the model is updated, the builder automatically generates standard CRUD services. Switch back to the Flash Builder perspective, and you can view them in the Data/Services tab
      services browser
      enlarge
    • The generated code is available in the Package Explorer. Files you don’t want to touch are prefixed with an underscore. The other files, like Player.as and PlayerService.as are available for you to customize.
      generated code
      enlarge
More Docs
  1. LCDS Modeler Guide (zip)
Conclusion

Once again, that’s it. I’ll have to learn something new about LCDS before I write more.


Comments

Core0000

10.20.2009

1

When I bind to Datagrid, I get the following error message:

Could not initialize Data Service
Missing or invalid configuration for destinations.

I’m running this on Windows XP.

10.20.2009

2

Hmmm, sounds like a configuration error to me.

Assuming you followed Part 1, can you run a RDS Configuration > Test Connection in the Modeler?

Core000

10.20.2009

3

Yes, the RDS Configuration test is successful. I am able to have your Part 1 and 2 working correctly. I am able to see the data in the RDS Query viewer.

Core000

10.20.2009

4

In the Data Model view, I deployed the model to the LCDS server. Now I get the following error:

Unable to invoke a fill operation on destination ‘MyApp.Player’ due to the following error: class org.hibernate.TransactionException:JDBC begin failed: .
null

Core000

10.20.2009

5

Justin, I got it working! I just had to restart the server. Looking forward to you next tutorials. Keep up the good work!

10.20.2009

6

I’m glad you got it working. When in doubt, restart!

Expect some new LCDS 3 stuff soon. Unfortunately, these things take time.

santiago

11.25.2009

7

please help, i’m newbie. when I try to connect to RDS it gives me error. what’s the default username/password, or how do I change them? thanks a lot

11.26.2009

8

@Santiago:

As I mentioned in Part 1, the easiest way to talk to get FB4 talking to RDS is to edit your LCDS app’s web.xml and set useAppserverSecurity = false. Once you do that, there’s no need for a username/password.

1.31.2010

9

Please help me, getting RDS error:

“RDS operation not supported : DBFUNCS”

1.31.2010

10

Some ideas:

1. Remember mysql connector jar (C:\lcds\tomcat\lib\mysql-connector-java-5.1.11-bin.jar)
2. Remember BlazeDS jar (C:\lcds\tomcat\webapps\lcds\WEB-INF\lib\flex-rds-server.jar)

2.1.2010

11

@Israel:

First, I recommend reading Part 1 for how to correctly install and configure LCDS. And second, this post is all about LCDS, so I wouldn’t expect RDS to work with BlazeDS.

2.1.2010

12

Yes ok.
I was wrong with version, it really was LiveCycle BlazeDS.
I’m having some problems with java mysql connection.
Thanks for the help.

2.1.2010

13

Parabéns!
Repeated step-by-step today and it worked.
You’re the man.

Norbert Wassink

2.6.2010

14

Im getting RDSDispatchServlet: Data source not found: java:/comp/env/jdbc/ error when selecting the tables in the RDSDataView. Any ideas ?

2.6.2010

15

@Norbert:

First, I recommend re-reading Part 1 for how to correctly install and configure LCDS.

Second, “data source not found” sounds like something is wrong with the db connection to me. So, I’d verify that the mysql db exists and the name is correct in the tomcat context config (in /tomcat/conf/Catalina/localhost/).

Cong

7.28.2010

16

Great tutorial and I have re-read parts 1 and 2 many times over but I cannot seem to get it working.

The RDS connection test is successful but when i try and run the application i get a:

Could not initialize DataService
Missing or invalid configuration for destinations: ["MyApp.Player"]

i can’t for the life of me figure it out, i can see the table in data model and see the table data as well but it wont’ show when i run the application.

any thoughts?

saumya

12.6.2010

17

Hi, Thanks for the post!
Can you tell me where in this setup can I add custom queries for my application ?

I want to define custom database queries to be executed on events.

Where would I define that ?

Many thanks.

12.9.2010

18

@saumya: I’m not exactly sure what you want to query, but LCDS makes it easy to add derived properties to entities. It also has a straightforward mechanism to build pass-through filters that enable you to write custom JPQL queries to return a set of entities. Beyond that, LCDS 3.1 enables you to write services directly in Java so you can do anything you want.

For derived properties and pass-through filters, see my InsideRIA articles: Getting Real With LCDS 3, Part 1 and Getting Real With LCDS 3, Part 2.

© 2017 saturnboy.com