Installing UpToDater

  1. Make sure that the uptodater.jar file and the following libraries are in your WEB-INF/lib directory (or made available via the classpath to your application server). Refer to the dependencies document for the correct version of these libraries. You can download a copy of everything from jakarta or from your maven repository. At a minimum, you must have
    • commons-logging.jar
    • commons-lang.jar
    • log4j.jar (or an alternative commons-logging implementation)
  2. Define the uptodater in your deployment descriptor.

    To Deploy As A Servlet

                    
    <servlet>
        <servlet-name>UpToDater</servlet-name>
        <servlet-class>org.sourceforge.uptodater.j2ee.UpToDaterServlet</servlet-class>
        <init-param>
        <!-- the jndi name for your datasource -->
            <param-name>datasource</param-name>
            <param-value>java:jdbc/YourJdbcPool</param-value>
        </init-param>
        <init-param>
        <!-- the name of the table to use -->
            <param-name>tablename</param-name>
            <param-value>uptodater</param-value>
        </init-param>
        <init-param>
        <!-- the zipfile for your changes; for example -->
            <param-name>zipfile</param-name>
            <param-value>dbupdates.zip</param-value>
        </init-param>
        <!-- The servlet should load before any business classes access the database. -->
        <load-on-startup>1</load-on-startup>
    </servlet>
                    
                

    To Deploy As An MBean On JBoss

                    
        <service>
            <mbean code="org.sourceforge.uptodater.j2ee.jboss.JbossUpToDater" name="uptodater:service=UpToDater">
              <attribute name="UpDateZip">updates.zip</attribute>
              <attribute name="DatasourceName">java:jdbc/YourJdbcPool</attribute>
              <attribute name="TableName">ddlchanges</attribute>
            </mbean>
        </service>  
                                

    A generic JMX implementation is also available, see the src for details.

  3. Create a zipfile containing your change files, and include it in the webapp. See the change files drafting db update files.
  4. Create a table for UpToDater to use. This should match the tablename you specified in the setup file. There are table create scripts in the src/sql directory. Here is a sample for SQL Server:
    create table uptodater (
        sqltext_hash varchar(100) primary key not null,
        insert_date datetime not null default getdate(),
        description varchar(250) not null,
        sqltext text,
        applied_date datetime
    )