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.