With the beta release of LiveCycle Data Services 3, Adobe has changed the game by bringing model driven development to the forefront. The geniuses from the entity formerly known as Macromedia have put together a compelling product if you are in the business of enterprise RIAs like us. Here are a few choice words from Adobe about the beta release.
Now on to the fun part: playing with our new toy. Vroom, vroom! In Part 1, I’ll walk through getting started with LCDS sitting on top of MySQL. Part 2 covers using the Modeler plugin in Flash Builder 4 to bring the dream of model driven development to reality.
NOTE: This article was written for LCDS 3 Beta 1, but I assume it’s mostly relevant for Beta 3 (released at AdobeMAX) and all future versions of LCDS 3.
NOTE 2: The Mac installer for Beta 3 (released at AdobeMAX) does not included the integrated Tomcat which is a huge pain in the ass for all Mac developers. I recommend you grab the integrated Tomcat out of the Windows installer.
Setup MySQL
- Install & start MySQL (this is an exercise for the reader, I remember it being a little painful on my Mac)
- Create a new db & user:
mysql -uroot -pCREATE DATABASE mydb; CREATE USER 'myusr'@'localhost' IDENTIFIED BY 'mypassword'; GRANT ALL PRIVILEGES ON mydb.* TO myusr@localhost;
NOTE: Don’t use
userin any part of a username (ex:myuserdoesn’t work) because it is a reserved word in MySQL.
- Create some sample tables:
mysql -umyusr -pmypassword mydbDROP TABLE IF EXISTS team; CREATE TABLE team ( id INT NOT NULL AUTO_INCREMENT, name VARCHAR(150), PRIMARY KEY (id) ); DROP TABLE IF EXISTS player; CREATE TABLE player ( id INT NOT NULL AUTO_INCREMENT, name VARCHAR(150), NUMBER INT NOT NULL, salary INT NOT NULL, team_id INT NOT NULL, PRIMARY KEY (id) );
- Insert data:
-
INSERT INTO team (name) VALUES ("Denver Broncos"); INSERT INTO team (name) VALUES ("Oakland Raiders"); INSERT INTO player (name,NUMBER,salary,team_id) VALUES ("Jay Cutler", 6, 6497500, 1); INSERT INTO player (name,NUMBER,salary,team_id) VALUES ("Champ Bailey", 24, 8003050, 1); INSERT INTO player (name,NUMBER,salary,team_id) VALUES ("Eddie Royal", 19, 2539830, 1); INSERT INTO player (name,NUMBER,salary,team_id) VALUES ("Tony Scheffler", 88, 612480, 1); INSERT INTO player (name,NUMBER,salary,team_id) VALUES ("JaMarcus Russell", 2, 16872400, 2); INSERT INTO player (name,NUMBER,salary,team_id) VALUES ("Darren McFadden", 20, 4375000, 2); INSERT INTO player (name,NUMBER,salary,team_id) VALUES ("Sebastian Janikowski", 11, 2625000, 2);
NOTE: Ignore the fact that Jay Cutler now plays for Da Bears.
-
Digging Deeper: Setting up a database is required, but setting up tables or inserting data is not. You can use the model driven development features of LCDS (and the Modeler plugin) to create all of your tables and data.
Setup LCDS
- Grab LCDS 3 Beta from Adobe Labs (download)
- Run installer & choose to install with bundled Tomcat (on Mac this installs to
/Applications/lcdsand the bundled Tomcat to/Applications/lcds/tomcat) - Create a new LCDS app, by copying the template app (in
lcds/tomcat/webapps/lcds) to a new folder:cd /Applications/lcds/tomcat/webappscp -R lcds myapp
- Enable RDS (Remove Dev Services) – This enables some dev only stuff like updating the database tables on the server directly from Flash Builder. For obvious security reasons, RDS would never be running in a production environment.
- Edit
/Applications/lcds/tomcat/webapps/myapp/WEB-INF/web.xml - Uncomment the entire RDS section
- Set
userAppserverSecurity = false(in the newly uncommented RDS section)
- Edit
- Update
services-config.xmlto avoid collisions with templatelcdsapp:cd /Applications/lcds/tomcat/webapps/myapp/WEB-INF/flex- Edit
services-config.xml:- In the
<channel-definition id="my-rtmp">section, change port 2038 to port 2039 - In the
<channel-definition id="my-nio-amf">section, change port 2880 to port 2881 - In the
<channel-definition id="my-nio-amf-poll">section, change port 2880 to port 2881 - In the
<channel-definition id="my-nio-http">section, change port 2880 to port 2881
- In the
NOTE: As an alternative, you can just remove the template
lcdsapp and skip the collision avoidance stuff above.
Setup LCDS to talk to MySQL
- Get MySQL Connector/J, and be sure to match the version to your MySQL version (download)
- Put
mysql-connector-java-5.1.7-bin.jarinto Tomcat’slibfolder:cp mysql-connector-java-5.1.7-bin.jar /Applications/lcds/tomcat/lib/
- Config Tomcat to recognize your MySQL db by creating a new Context for your app:
cd /Applications/lcds/tomcat/conf/Catalina/localhostcp lcds.xml myapp.xml- Add a JDBC Resource block to
myapp.xml, so it looks like this:<Context privileged="true" antiResourceLocking="false" antiJARLocking="false" reloadable="true"> <!-- JOTM --> <Transaction factory="org.objectweb.jotm.UserTransactionFactory" jotm.timeout="60"/> <!-- MySQL --> <Resource name="jdbc/MyDB" auth="Container" type="javax.sql.DataSource" maxActive="100" maxIdle="30" maxWait="10000" username="myusr" password="mypassword" driverClassName="com.mysql.jdbc.Driver" url="jdbc:mysql://localhost:3306/mydb?autoReconnect=true"/> </Context>
Start LCDS
- Point Tomcat to the bundled Tomcat installed with LCDS:
export CATALINA_HOME=/Applications/lcds/tomcat- Windows:
set CATALINA_HOME=C:\lcds\tomcat
- Set Java to Java 6:
export JRE_HOME=/System/Library/Frameworks/JavaVM.framework/Versions/1.6/Home- Windows:
set JRE_HOME=C:\Program Files\Java\jdk1.6.0_14\jre
- Run it:
/Applications/lcds/tomcat/bin/catalina.sh run- Windows:
C:\lcds\tomcat\bin\catalina.bat run
- Sometimes Tomcat does not get the value of
JRE_HOME(usually on Windows). The caused by a hard-coded value insidecatalina.sh, you’ll need to edit this file and comment out that line. - Verify it all worked by browsing to:
http://localhost:8400/myapp/
- A helpful bash script that does #1 – #3 all in one shot:
-
#!/bin/bash export CATALINA_HOME=/Applications/lcds/tomcat export JRE_HOME=/System/Library/Frameworks/JavaVM.framework/Versions/1.6/Home /Applications/lcds/tomcat/bin/catalina.sh run
- Windows:
set CATALINA_HOME=C:\lcds\tomcat set JRE_HOME=C:\Program Files\Java\jdk1.6.0_14\jre C:\lcds\tomcat\bin\catalina.bat run
-
More Docs
- What’s new in LCDS 3
- LCDS Dev Guide (zip)
- Tutorial Video – awesome, 20 min long, and very worthwhile
To Be Continued…
That’s it for Part 1. LCDS should be up and running on top of MySQL. Next up, Part 2 covers the Modeler plugin and model driven development.

Megharaj
7.14.2009
Thanks for your post which explains step by step to configure the mysql database
Please post part 2 version of this article ASAP.
Corby James
3.15.2010
When I’m building the model, I get this error:
I’m not sure what configuration file this refers to. Any ideas?
justin
3.15.2010
@Corby: Seems like FB4 doesn’t like the LCDS service. I have a one idea:
Sometimes seems like LCDS doesn’t automatically regenerate the generated code when you make changes to the model.
So here’s a helpful trick to force regeneration: Switch to the Flash Builder perspective, go to the Data/Services view, and click the Edit Active Data Model icon. For some unknown reason this seems to force code regeneration.
Chris Curnow
3.27.2011
Hi, This is a great post. Thanks so much for the detailed instructions. I would have had no idea how to do this.
I’m having one problem though. Everything in Part 1 and Part 2 works until I try to expand “Tables”. It tells me it couldn’t connect to the database.
I’m wondering if there is anyway to directly test the configuration to mysql?
Thanks again
justin
3.28.2011
@Chris: Sorry, I haven’t touched LCDS is almost 2 years. Obviously, you’ll want to double check all the usual stuff: db username, db password, db name, db privileges, etc.
After that, you are on your own. Good luck!
Chris Curnow
3.28.2011
Thanks. It’s still a great post.
Chris Curnow
3.28.2011
Just in case anyone else comes across this thread, the problem had something to do with leaving the lcds app in place. No matter what I did with ports, I still got port conflicts.
Just move the lcds app, and all is OK.
See this thread http://forums.adobe.com/thread/627988.
regards
Chris