Dbutil tutorial (6) hbase basic query support

Source: Internet
Author: User

With the development of social information, we have entered an explosive growth period of information. Every day, we can create a lot of information, such as location, social networking, photos, and work. This information includes structured data and unstructured data. Because of this situation, relational databases and non-relational data coexist. As the query pressure increases, dbutil also integrates popular nosql data, such as hbase.

The basic data environment is:Hadpood + hbase + hive Environment

Dbutil configxml configuration method:

 
<! -- Hbase --> <resource JNDI = "JDBC/hbase" driverclass = "org. apache. hadoop. hive. JDBC. hivedriver "dbusername =" "dbpassword =" "jdbcurl =" JDBC: Hive: // 192.168.2.212: 10000/Default "initsize =" 2 "minpoolsize =" 1 "maxpoolsize =" 10 "maxstatements =" 50 "maxidletime =" 60 "/>

After configuring the hive connection, run the following query:

Package COM. shine. dbutil; import Java. SQL. sqlexception; import COM. shine. dbutil. model. dbmodel; public class hiveexample {/*** @ Param ARGs */public static void main (string [] ARGs) throws sqlexception {dbutil. getinstance (). init ("e :\\ javaworkspace \ javaframework2.5 \ SRC \ com \ shine \ dbutil \ config \ dbxml. XML "); dbmodel model = dbutil.getinstance(cmd.exe cutequery (" JDBC/hbase "," select. * From test a "); While (Model. Next ()! = 0) {system. Out. println (model. getdataxml () ;}model. Close ();}}

AboveCodeHbase has been persistently managed through dbutil.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.