This tutorial will cover how to use ART with CUBRID. We will assume that CUBRID Database Server has already been installed. Otherwise, please prepare it.
Since ART is a Web application written in Java, it needs a Java Servlet Container to run. If you do not have one, you can install Apache Tomcat (see installation instructions for Ubuntu, Linux, Windows). Once installed make sure it is running.
Once you download ART, extract it and you will find art.war file. Now we need to deploy this app to Tomcat. For this just copy it to webapps/ directory of Tomcat. In Ubuntu it is located in /var/lib/tomcat7/webapps/.
sudo cp /home/user/art-2.2.1-full/art.war /var/lib/tomcat7/webapps/
Once copied, ART web app will be deployed in /var/lib/tomcat7/webapps/art directory.
Since we want to use CUBRID as a backend database for ART, let's create a database first. We will use cubrid createdb command line utility. Alternatively you can also create a database using CUBRID Manager GUI administration tool.
Open your command line terminal and type the following commands to create artdb database. Depending on how you have installed CUBRID, you may want to navigate to a particular directory where you want to keep your database. Then:
cubrid createdb artdb
This will create a database with two users dba and public, both with blank passwords.
In order to use ART, we need to popular our artdb database with the necessary tables.
We will use CSQL command line SQL Interpreter for CUBRID in order to execute all SQL statements from these files.
csql artdb -i /home/user/art-2.2.1-full/database/art_tables.sql csql artdb -i /home/user/art-2.2.1-full/database/quartz/tables_cubrid.sql
Done! Now all tables are set in our artdb CUBRID database.
For ART to connect to CUBRID database it has to communicate with it through CUBRID JDBC driver. Therefore, we need to copy CUBRID JDBC driver to a directory accessible by Tomcat. You can find CUBRID JDBC driver in $CUBRID/jdbc/ directory.
There are two places where you can place the JDBC driver:
If you plan to use CUBRID JDBC driver in other applications, you may directly keep it among Tomcat libraries instead of maintaining a copy for each application. But for simplicity, in this tutorial we will place the driver in ART /lib directory.
sudo cp $CUBRID/jdbc/cubrid_jdbc.jar /var/lib/tomcat7/webapps/art/WEB-INF/lib/
Now you need to restart Tomcat for it to load CUBRID JDBC driver.
~$ /usr/share/tomcat7/bin/shutdown.sh ~$ /usr/share/tomcat7/bin/startup.sh
If you have any issues stopping and starting Tomcat, see this Tomcat tutorial.
Now we need to tell ART to use our artdb database.
When you press Submit you will be redirected to the main dashboard at ART Admin Console.
Now before we log out, we must create ART super admin user.
A new page will open where you can enter user information.
To test your new user credentials, you may log out from ART by clicking on Log Off on top left corner of the page.
Now you are ready to create your ART Queries. Just follow the simple steps below and you will set up ART with CUBRID in no time.
From the Admin Console, click on the Datasources button.
A new Manage Datasource page will open. Choose ADD from the list of Actions and press on Submit button.
In the new page enter your database connection info. Here you database should be different from ART's repository database. This one should be the one you want to monitor and receive reports about.
Before you click on Submit button, make sure your database (in our case demodb) has been started. Type the following command to make sure it has been started.
cubrid server start demodb
If you database is not available, you will see the following error message:
Testing connection ...
The datasource parameters you specified are not correct and the connection to the database has failed.
Anyway, the datasource has been defined in ART - but you will probably get an error when trying to execute queries that use it.
Exception Description: cubrid.jdbc.driver.CUBRIDException: Failed to connect to database server, 'demodb', on the following host(s): localhost:localhost
Once you have confirmed that your database has been started and you have entered datasource info, click on Submit button.
Back to the Admin Console, click on the Objects button to reach the Object Management Console.
Click on Create New Object and define a new query.
This sample query shows how to define parameters: just surround the parameter label with #.
If the query doesn't use parameters, this step can be skipped.
From the Admin Console, click on Users to create a new user and then on User Privileges to grant the user permission to run the query.
Have the user to set the View Mode to Schedule to get the result in his mailbox at a given time (if the user has the required admin level to schedule jobs).