Using a MySQL Datasource with Tomcat and LCDS 3.0

I’ve spent today becoming familiar with LiveCycle Data Services 3.0 and am excited by the direction the product is going in. You’re going to hear a lot more about model driven development from us and I think LCDS 3.0 is a product that 1) makes full use of the Flash Platform and Flex’s capabilities and 2) shows what it takes to build a genuine rich Internet application.

One issue I ran into though was getting a MySQL database to work with the Tomcat installation of LCDS 3.0 so I wanted to quickly blog the steps I went through. The instructions here were hugely helpful and I wanted to break them down for an LCDS-specific install of Tomcat

  • First you need to get the MySQL drivers for Java which are available here. As of this post the most recent drivers are version 5.1.
  • Copy the mysql-connector-java-5.1.8-bin.jar file into the lib/ directory of your tomcat install (/Applications/lcds/tomcat/ by default).

Once that’s copied, open the xml file for your specific server inside of the tomcat/conf/Catalina/localhost/ directory. In this case, I’m using the default lcds server, so I need to change lcds.xml. You’ll also see the other servers that come with LCDS 3.0 like lcds-samples.xml and ds-console.xml.

Copy this code into that file anywhere inside the Context tags and replace {databaseName} with the name of your database, and change the other {} variables accordingly.

    <Resource name="jdbc/{databaseName}" type="javax.sql.DataSource"
          driverClassName="com.mysql.jdbc.Driver"
          url="jdbc:mysql://{host}:{databasePort}/{databaseName}"
          username="{username}" password="{password}" />

Now you’re all set! Once you’ve got RDS set up on your LCDS 3.0 server you’ll be able to see the MySQL database and start using it for your model driven development.