CUBRID: A FOSS RDBMS to Re­alise Your Next Big Idea

CUBRID is a free and open source re­la­tional data­base man­age­ment en­gine. The power of CUBRID lies in its ca­pa­bil­ity to sup­port en­ter­prise level fea­tures. It pro­vides cer­tain novel fea­tures in the form of ob­ject-ori­ented data­base el­e­ment re­la­tions, a na­tive

OpenSource For You - - Developers -

Data­bases are an in­te­gral part of any soft­ware ap­pli­ca­tion. The per­sis­tence that the data­bases bring in to the ap­pli­ca­tions en­able ef­fi­cient re­triev­abil­ity of rel­e­vant data from non­volatile stor­age. There are a large num­ber of data­bases such as MySQL, Mari­aDB, CouchDB, etc. This ar­ti­cle pro­vides an overview of a pow­er­ful en­ter­prise­ready data­base man­age­ment en­gine, termed CUBRID (pro­nounced ‘cube­rid’).

The first ap­pear­ance of CUBRID was in Novem­ber 2008. The lat­est sta­ble re­lease is CUBRID 10.1, which was re­leased in July 2017. It is writ­ten in the C lan­guage and sup­ports two ma­jor op­er­at­ing sys­tems—GNU/Linux and Win­dows.

The ma­jor fea­tures of CUBRID are:

Free and open source

Pow­er­ful

Of­fers en­ter­prise fea­tures

CUBRID is com­pletely free of cost. As it is open source, you can choose to cus­tomise it to your spe­cific re­quire­ments. Its en­ter­prise fea­tures are listed be­low.

High avail­abil­ity: The high avail­abil­ity of CUBRID is at­trib­uted to its pow­er­ful Heart­beat na­tive en­gine. It works very ac­cu­rately and has au­to­matic fail­over tech­nol­ogy, built in. Glob­al­i­sa­tion: CUBRID has ex­cel­lent I18N (in­ter­na­tion­al­i­sa­tion) and L10N (lo­cal­i­sa­tion) fea­tures. Scal­a­bil­ity and Big Data op­ti­mi­sa­tion: CUBRID of­fers au­to­matic vol­ume ex­pan­sion with sup­port for mul­ti­ple vol­umes.

High per­for­mance op­ti­mised for Web ser­vices: CUBRID has sup­port for multi­threaded and multi­server ar­chi­tec­ture. It has na­tive bro­ker mid­dle­ware. The in­ten­sive caching fea­ture that CUBRID of­fers is ex­cel­lent.

Get­ting started with CUBRID

This sec­tion de­tails the steps re­quired to get started with the CUBRID data­base man­age­ment en­gine. The over­all process is il­lus­trated in Fig­ure 3.

Step 1: The first step is to down­load and in­stall the CUBRID en­gine. The of­fi­cial Web page pro­vides down­load links for both GNU/Linux and Win­dows (https://www.cubrid.org/down­loads/ os-se­lect/64-bit/en­gine). You can down­load the lat­est sta­ble re­lease of CUBRID 10.1 and ex­e­cute the in­staller.

Step 2: After suc­cess­ful in­stal­la­tion, you can start the CUBRID ser­vice by ex­e­cut­ing the fol­low­ing com­mand in a ter­mi­nal:

cubrid ser­vice start

Step 3: Once the CUBRID ser­vice is started, you can cre­ate and start us­ing the data­bases. Two sam­ple com­mands are shown be­low:

cubrid cre­at­edb os­fytest en_US cubrid server start os­fytest

Step 4: The next step is to con­nect to the data­base us­ing CSQL. The com­mand for do­ing that is as fol­lows:

csql –user PUB­LIC os­fytest

Step 5: After the com­ple­tion of all the above steps, you can run the re­quired SQL queries.

CUBRID vs MySQL

As MySQL is a lead­ing open source data­base man­age­ment sys­tem (DBMS), you may get asked about their rel­a­tive mer­its. First and fore­most, CUBRID is not de­rived from MySQL. It is a sep­a­rate RDBMS tool which has around 20 years of de­vel­op­ment his­tory, as men­tioned ear­lier.

Re­gard­ing per­for­mance, the of­fi­cial CUBRID doc­u­men­ta­tion claims that it is faster than MySQL in sce­nar­ios when there are many con­cur­rent re­quests. Un­like some other RDBMSs, CUBRID has no sep­a­rate en­ter­prise li­cence. It has only one flavour, which is un­der GPL ver­sion 2 or higher. Hence, CUBRID is com­pletely free with all its en­ter­prise level fea­tures.

CUBRID lan­guage sup­port

CUBRID sup­ports many pop­u­lar pro­gram­ming lan­guages. It does so by pro­vid­ing lan­guage­spe­cific APIs (Ap­pli­ca­tion Pro­gram­ming In­ter­faces). CUBRID is writ­ten in C and hence there is a na­tive C driver. This driver is re­ferred to as CCI. Apart from this, CUBRID has sup­port for the fol­low­ing pro­gram­ming lan­guages:

Java

PHP

Ruby

Python

Perl

Node.js

ADO.NET driver for .NET pro­gram­ming lan­guages In this ar­ti­cle, ex­am­ples with two pop­u­lar pro­gram­ming lan­guages — Java and Python — are given.

A sim­ple CUBRID ex­am­ple with Java

This sec­tion in­tro­duces you to a com­pact and stand­alone Java pro­gram that in­ter­acts with CUBRID. For this pro­gram to work, you should have al­ready in­stalled CUBRID, hav­ing fol­lowed the steps men­tioned ear­lier, and it re­quires the JDBC driver as well. If your sys­tem doesn’t have it, then do in­stall it. The in­staller is avail­able at https://www.cubrid.org/ down­loads/os-se­lect/64-bit/driv­ers/jdbc--

pack­age org.cubrid.demo; im­port java.sql.Con­nec­tion; im­port java.sql.Re­sultSet; im­port java.sql.State­ment; im­port static java.sql.DriverMan­ager.getCon­nec­tion; pub­lic class Main { pub­lic static void main(String[] args) {

String url = “jdbc:cubrid:lo­cal­host:33000:de­modb:publ ic::?charSet=utf8”; try { Class.forName(“cubrid.jdbc.driver.CUBRIDDriver”); Con­nec­tion conn = getCon­nec­tion(url, null, null); conn.setAu­toCom­mit(false); try (State­ment stmt = conn.cre­ateS­tate­ment()) { // Cre­ate a new ta­ble and in­sert some data stmt.ex­e­cute(“drop ta­ble if ex­ists mytable”); stmt.ex­e­cute(“cre­ate ta­ble mytable(my­col­umn string)”);

stmt.ex­e­cute(“in­sert into mytable val­ues(‘This is

my first in­serted string’)”);

Re­sultSet rs = stmt.ex­e­cuteQuery(“se­lect * from mytable”);

// Re­trieve and out­put the ta­ble data while (rs.next()) { Sys­tem.out.println(rs.getString(“my­col­umn”)); } } conn.close();

} catch (Ex­cep­tion e) { e.print­S­tack­Trace(); }

}

}

This pro­gram can be com­piled and ex­e­cuted, with the fol­low­ing two com­mands:

javac TestCUBRID.java java TestCUBRID

It can be eas­ily in­ferred from the code that con­nect­ing and han­dling CUBRID is very sim­i­lar to other data­bases.

So, if you have pro­grammed for other data­bases in Java, you don’t need to learn any­thing ex­tra­or­di­nary in or­der to work with CUBRID.

An ex­am­ple in Python

To ma­nip­u­late the CUBRID data­base with Python, you need CUBRIDdb, which is the Python ex­ten­sion pack­age. The CUBRID Python driver can be in­stalled in var­i­ous ways. The eas­i­est of them is to go with easy_in­stall. The sim­ple com­mand for per­form­ing this task is shown be­low:

easy_in­stall CUBRID-Python A com­plete ex­am­ple with Python is shown be­low:

im­port CUBRIDdb conn = CUBRIDdb.con­nect(‘CUBRID:lo­cal­host:33000:de­modb’, ‘pub­lic’, ‘’) cur = conn.cur­sor()

# Plain in­sert state­ment cur.ex­e­cute(“IN­SERT INTO posts (id, ti­tle, body, last_ up­dated) VAL­UES (1, ‘Ti­tle 1’, ‘Test body #1’, CURRENT_ TIMESTAMP)”)

# Pa­ram­e­ter­ized in­sert state­ment args = (2, ‘Ti­tle 2’, ‘Test body #2’) cur.ex­e­cute(“IN­SERT INTO posts (id, ti­tle, body, last_ up­dated) VAL­UES (?, ?, ?, CURRENT_TIMESTAMP)”, args)

conn.com­mit()

The com­plete in­for­ma­tion about han­dling CUBRID with Python is avail­able at https://www.python.org/dev/ peps/pep-0249/.

GUI tools for CUBRID

There are var­i­ous graph­i­cal user in­ter­face tools avail­able for han­dling CUBRID in an eas­ier man­ner. These are listed in Ta­ble 1. CUBRID HA What ‘HA’ refers to is ‘high avail­abil­ity’. This is a fea­ture that en­ables un­in­ter­rupted ser­vice in sce­nar­ios when there is fail­ure in ei­ther the hard­ware, soft­ware or the net­work. CUBRID HA in­cludes more than one server sys­tem. These are used to pro­vide un­in­ter­rupted ser­vices when an in­di­vid­ual server fails. CUBRID HA syn­chro­nises data­bases among mul­ti­ple servers. This fea­ture can be en­abled for mis­sion­crit­i­cal ap­pli­ca­tions when there is a need for 24/7 avail­abil­ity of ser­vice. More in­for­ma­tion on CUBRID HA is avail­able at https://www.cubrid. org/man­ual/en/10.1/ha.html.

If you want to con­tribute to CUBRID RDBMS, then check out the source from https://github.com/CUBRID. Based on your ex­per­tise, you can get in­volved in con­tribut­ing to the de­vel­op­ment of driv­ers, tools, con­tent man­age­ment sys­tems (CMS), etc. Even as just a user, you can re­port bugs by open­ing is­sues in JIRA or by sim­ply send­ing an email to bug@cubrid.org.

CUBRID is an ac­tively main­tained re­la­tional data­base en­gine. Re­cent up­dates on it are avail­able at https://www. cubrid.org/blog. Ref­er­ences [1] https://www.cubrid.org/ [2] https://www.cubrid.org/doc­u­men­ta­tion By: Dr K.S.Kup­pusamy The au­thor is an as­sis­tant pro­fes­sor of com­puter sci­ence at Pondicherry Cen­tral Univer­sity. He has 13+ years of teach­ing and re­search ex­pe­ri­ence in academia and in­dus­try. He can be reached at kskuppu@gmail.com .

Fig­ure 3: Get­ting started with CUBRID

Newspapers in English

Newspapers from India

© PressReader. All rights reserved.