Apache VCL logo Apache Software Foundation logo

Apache Derby Database

Using Apache Derby Database

NOTE: The current code in the trunk does not support Derby (21 Aug 2009)


You should have installed:

Downloading and Setting Up the Database for VCL

  1. Download Apache Derby and install it.

    cd ~
    wget http://apache.g5searchmarketing.com/db/derby/db-derby-
    tar -xzf db-derby-
    mkdir /opt/Apache
    mv db-derby- /opt/Apache/derby
    export DERBY_HOME="/opt/Apache/derby"
    export CLASSPATH="${DERBY_HOME}/lib/derby.jar:${DERBY_HOME}/lib/derbytools.jar:${CLASSPATH}"
  2. Create a database in Apache Derby. The database has to be placed in the path /opt/. Replace 'vcluser' and 'vcluserpassword' with the user and password you want.

    cd /opt/
    connect 'jdbc:derby:vcl1;create=true;user='vcluser';password='vcluserpassword';';
  3. Download vcl.sql and the derby-parser.pl. Edit the file 'derby-parser.pl'. The variables '$user' and '$pw' should match your database.

    svn export https://svn.apache.org/repos/asf/vcl/trunk/mysql/vcl.sql
    wget http://vcl.apache.org/comm/commprojects/derby-parser.pl
    chmod a+x derby-parser.pl
  4. Import vcl-derby.sql file into database. It is a good idea to direct the output to file and check if there were any errors.

    ij vcl-derby.sql > import.log

Setting up the dbd_jdbc Server

  1. Install log4j

    cd ~
    wget http://www.apache.org/dyn/closer.cgi/logging/log4j/1.2.15/apache-log4j-1.2.15.tar.gz
    tar -zxf apache-log4j-1.2.15.tar.gz
    mv apache-log4j-1.2.15 /opt/Apache/derby/lib/
  2. When installing the perl modules using the 'install_perl_libs.pl' (/usr/local/vcl/bin/install_perl_libs.pl) two extra modules need to the installed for Derby. Open the file 'install_perl_libs.pl' and in the list of modules to download add the following two modules.

  3. Run the scrips as normal

    perl /usr/local/vcl/bin/install_perl_libs.pl
  4. Copy some file from the modules to Derby directory

    cp /tmp/perl-modules/DBD-JDBC-0.71/dbd_jdbc.jar /opt/Apache/derby/lib/
    cp /tmp/perl-modules/DBD-JDBC-0.71/log4j.properties /opt/Apache/derby/lib/apache-log4j-1.2.15
  5. Create a script file which will launch the dbd_jdbc Server. Save it under any name and directory (e.g. /opt/server.sh), only remember that this scrips needs to be executed every time you start up the server. The file should contain

    java -Djdbc.drivers=org.apache.derby.EmbeddedDriver -Ddbd.port=12345 -classpath /opt/Apache/derby/lib/derby.jar:/opt/Apache/derby/lib/dbd_jdbc.jar:/opt/Apache/derby/lib/apache-log4j-1.2.15/log4j-1.2.15.jar:/opt/Apache/derby/lib/apache-log4j-1.2.15/  com.vizdom.dbd.jdbc.Server &

    Note1: if some of your paths are different you need make the changes in this scrips file as well
    Note2: currently port 12345 is used for connecting to Derby, this is hard coded. Can be changed on a later stage.

  6. Make the script executable

    chmod a+x /opt/server
  7. Start the Server