Open Source RDBMS - Seamless, Scalable, Stable and Free

한국어 | Login |Register

JWhoisServer CUBRID Tutorial


This tutorial will cover how to use JWhoisServer with CUBRID.

Install JWhoisServer

Here we will show the installation instructions for Ubuntu 12.04. If you are running other OS, you can find installation guide on jWhoisServer documentation.

For Ubuntu you can download the .deb file (visit SF.net/files/jwhoisserver/version <x.x.x.x>/deb/ directory). You will need two files:

  1. libjwhoisserver-utils-java_<version>_all.deb
  2. jwhoisserver_<version>_all.deb

GUI Installation

If you are running a Desktop version of Ubuntu, simply double click on libjwhoisserver-utils-java_<version>_all.deb. Once it is installed, double click on jwhoisserver_<version>_all.deb. The (2) is dependent on (1).

If it asks to choose the database type (MySQL, PostgreSQL), simply ignore this step. We will use CUBRID Database server in the next step.

Terminal Installation

In terminal, simply type in order:

dpkg -i libjwhoisserver-utils-java_<version>_all.deb
dpkg -i jwhoisserver_<version>_all.deb

If you run into any issues, check out the detailed documentation on JWhoisServer site.

Configure CUBRID Database

After installing JWhoisServer, you must configure the Database. In order to use CUBRID as the database, you must follow these easy steps. We will show how to do everything using command line tools. Know that you can use GUI CUBRID Manager similarly.

Create a database

Open your command line terminal and type the following commands to create jwhoisserver 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 jwhoisserver

This will create a database with two users dba and public, both with blank passwords.

Start the database

To use our newly created DB, we need to start it.

cubrid server start jwhoisserver

Populate JWhoisServer database

Run the following SQL scripts found in the sql/cubrid folder (In Ubuntu it is located in /usr/share/doc/jwhoisserver/sql/cubrid):

    1. struct.sql
    2. data.sql
    3. test.sql (optional)

    cd /usr/share/doc/jwhoisserver/sql/cubrid
    csql jwhoisserver -i struct.sql
    csql jwhoisserver -i data.sql
    csql jwhoisserver -i test.sql

    In CUBRID Manager, right click on the database and choose "Run SQL Script".

    Copy CUBRID JDBC driver

    For JWhoisServer to communicate with CUBRID Server, we need to provide it the JDBC driver. If your CUBRID Server is located on the same server, you can find its JDBC driver in $CUBRID/jdbc directory. Otherwise, you can always download the necessary version from CUBRID Downloads page.

    The JDBC driver should be copied into /jdbcdrivers directory of JWhoisServer (usually located in /etc/jwhoisserver/jdbcdrivers/).

    sudo cp $CUBRID/jdbc/cubrid_jdbc.jar /etc/jwhoisserver/jdbcdrivers/

    Configure server.cfg

    Using you favorite editor open /ets/jwhoisserver/server.cfg JWhoisServer's main configuration file. Right at the top you will see a section for database configurations as shown below. We need to set the connection parameters to use our CUBRID database. We will also define several other configurations for JWhoisServer to know which reserved keywords must be quoted.

    ###### db #####################################################
    
    # general database connection configuration
    
    db.type=cubrid
    
    # connections settings
    # see: /etc/jwhoisserver/dbconfig.cfg
    db.host=localhost
    db.port=30000
    db.name=jwhoisserver
    db.user=public
    db.pass=
    
    # the following configurations are for CUBRID database only
    # which needs to escape special reserved words
    
    db.person.tablejoin=LEFT JOIN country ON country_key\=country_fkey LEFT JOIN "type" on type_key\=type_fkey
    db.person.display=mntnr_fkey;"type";name;address;pcode;country."short" AS country;phone;fax;email;changed
    
    db.domain.displayshort="domain";'active' AS status
    db.domain.display="domain";mntnr_fkey;changed
    db.domain.table="domain"
    db.domain.qfield="domain"
    
    ###### END db #################################################

    That is all you need to configure JWhoisServer to use CUBRID as a backend database. Now let's run JWhoisServer.

    Start JWhoisServer

    To start JWhoisServer, run jwhoisserver with root user.

    sudo jwhoisserver

    You should get a message that "JWhoisServer is up and running". If you have ran the test.sql SQL script during the database population stage above, you can now run the following command to request whois information. In your second command line terminal, type:

    whois -h localhost -- test.tld

    Done!

    comments powered by Disqus
    Page info
    viewed 2403 times
    translations en
    Author
    posted 2 years ago by
    CUBRID
    Contributors
    updated 2 years ago by
    View revisions
    Share this article