Open Source RDBMS - Seamless, Scalable, Stable and Free

한국어 | Login |Register

ART CUBRID Tutorial


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.

Step 1: Install Tomcat

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.

Step 2: Deploy ART

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.

Step 3: Create and populate CUBRID Database

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.

Create a database

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.

Populate ART database

In order to use ART, we need to popular our artdb database with the necessary tables.

  1. EXTRACTED_DIR_PATH/database/art_tables.sql.
  2. EXTRACTED_DIR_PATH/database/quartz/tables_cubrid.sql.

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.

Step 4: Add CUBRID JDBC Driver to Tomcat

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:

  1. In root /lib/ directly of Tomcat: /usr/share/tomcat7/lib/.
  2. In /lib/ directory of ART web app: /var/lib/tomcat7/webapps/art/WEB-INF/lib/.

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.

Step 5: Configure ART

Now we need to tell ART to use our artdb database.

  1. Open localhost:8080/art in your browser to access ART Admin Console.
  2. Click on Properties button to define ART properties as well as database connection information.
  3. Enter database connection information:
    1. Username: public
    2. Password: (no password)
    3. JDBC Driver: cubrid.jdbc.driver.CUBRIDDriver
    4. URL: jdbc:cubrid:localhost:33000:artdb:public::
      1. localhost here is where CUBRID Server is located. If you have it on a remote server, indicate the remote IP address.
      2. 33000 is our CUBRID Broker port.
      3. artdb is our database name.
      4. public is our database user name.
  4. You may leave the rest properties intact unless you want to change.
  5. Press Submit to finish this step.

When you press Submit you will be redirected to the main dashboard at ART Admin Console.

art_admin_console.png

Now before we log out, we must create ART super admin user.

  1. Click on Users menu located on the left sidebar. You will see a "Manage Users" page with no users.
  2. Select ADD from the Action list and press Submit button.

art_add_user.png

A new page will open where you can enter user information.

  1. Username: artsuperadmin (this is example, you set your own).
  2. Password: set a desired password
  3. Keep Status as Active.
  4. Enter Full Name and Email.
  5. From Admin Level choose "Super Admin (manage everything)". This will be our main super admin.
  6. You may leave the rest with default settings. Then press Submit.

art_add_super_user.png

To test your new user credentials, you may log out from ART by clicking on Log Off on top left corner of the page.

Step 6: Using ART

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.

Login

Enter your super admin username and password you have just entered.

art_login.jpg

Define a new datasource

From the Admin Console, click on the Datasources button.

art_admin_console.png

A new Manage Datasource page will open. Choose ADD from the list of Actions and press on Submit button.

art_manage_datasources.png

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 Datasource

Testing connection ...

Connection Exception:

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.

art_add_cubrid_datasource.png

Define a new query

Back to the Admin Console, click on the Objects button to reach the Object Management Console.

objects.jpg

Click on Create New Object and define a new query.

new_object.jpg

This sample query shows how to define parameters: just surround the parameter label with #.

Click on Save Changes to reach the Object Editor page

save_changes.jpg

6. Click on the Parameters button, then New to create the new parameter

parameters.jpg

If the query doesn't use parameters, this step can be skipped.

That's all!

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).

Getting Help

If you have any questions, please post them in our Q&A site or post a comment on our forum.
comments powered by Disqus
Page info
viewed 2863 times
translations en
Author
posted 2 years ago by
CUBRID
Contributors
updated 2 years ago by
View revisions
tagged
Share this article