Posts tagged "MySQL"

Working with the DataExtractionAndUpdateDatabase ES2 Sample Application Part 1

I had a customer contact me for help in getting this sample application to work.
http://help.adobe.com/en_US/livecycle/9.0/samples/ServiceUsageSampleFormsDataExtractionAndUpdateDatabase.html

It’s a nice sample application that shows you how to extract data from a form, transform the XML using XSLT and then save it to a MySQL database table.

The directions don’t tell you how to create the MySQL database and this can be a challenge. You can find documentation on MySQL 5.1 (the version installed as part of an ES2 turnkey installation) here. To save you the trouble, I’ve summarized the steps you need to follow to make the process work.

Note: This assumes you are using a LiveCycle ES2 JBoss turnkey installation on Windows.

Note: There seems to be a problem with the Watched Folder end point configuration and I could only get this process to work by using the invoke command from Workbench. I’ll post a fix to the WatchedFolder configuration in another blog entry.

  1. Open a command prompt and navigate to the MySQL installation. This is {LiveCycle ROOT}\mysql\bin. So, in a turnkey installation with the default folders, you would need to go to C:\Adobe\Adobe LiveCycle ES2\mysql\bin
  2. The turnkey installation creates this MySQL database account. user = adobe, password=password. Login with the adobe user using the mysql command line tool. The command is:
    mysql -u adobe -p
    Enter “password” when prompted for the password.
    login-resized.png
  3. Now you can create a test database by entering the command:
    CREATE DATABASE test;
  4. Switch to this database by entering the command:
    use test
    Note: you do not need a semicolon (;) for this command
  5. Now you can create the table by entering the command:
    CREATE TABLE tb_DataExtractionAndUpdateDB(data BLOB);
    Your command line prompt should look like the screen shot below.
    create_db_and_table-resized.png

    Please leave the mysql prompt open so we can verify the process updates the table later on.
  6. Now the database and table are created. You should verify the configuration of the data source (test-ds.xml). This was part of the collateral/resources folder that you downloaded earlier.
    You only need to change the user from root to adobe, if you’re using the default MySQL user and password. If you’ve chosen a different user/password, make sure you update it here. Since I’m using the default adobe user, my configuration looks like this.
    test-ds-resized.png
    This file should be copied to your deploy directory. If you used the default installation settings, this would be:
    C:\Adobe\Adobe LiveCycle ES2\jboss\server\lc_turnkey\deploy
    Note:If you changed anything in this file, then you will need to restart the LiveCycle server (just JBoss, not Windows) for the change to take affect.

  7. Open the DataExtractionAndUpdateDatabase process in LC Workbench.
    process-resized.png
  8. Double-click on the properties for the SQL activity which has the caption “Persist data to Database”.
    process_properties.png
  9. Click on the button with a caption of “…” next to the SQL Statement property.
    sql_default-resized.png
  10. Click on the test button. In the “Test Result” box you should see “Number of rows affected: 1″. Let’s check this in the database. Go back to the mysql command prompt and type in
    select * from tb_DataExtractionAndUpdateDB;

    you should see this result:
    check_results_1.png
  11. We’ve now proven we can insert a null BLOB. Let’s test that one with data will work too. Change the SQL to as shown in the screenshot below and then test it. Don’t save the changes!
    sql_test-resized.png
  12. Now let’s go back to the mysql command prompt and run the query again. You should see this:
    check_results_2.png
  13. Congratulations! You’ve now proven that the sample application works in your turnkey environment.