Skip to main content

Hadoop Hive Data Base Fetching records in Oracle SOA

Hi Everyone,

Today we are going to see how we can execute a Select statement in Hadoop Hive data base using oracle soa DB adapter.

Before going into configuration & deployment steps, One thing oracle SOA/Weblogic does not have default built in support to connect over HIVE DB, to full fill same we have to use external JAR's of hadoop hive which will be configured in oracle weblogic.

Following is list of JAR's which will be used inside configuration.
  • hive-jdbc-1.2.1-standalone.jar
  • hadoop-common.jar
JDev configuration for Data base connection:

Click on Driver Class "Add button".
  • Driver class:org.apache.hive.jdbc.HiveDriver
  • Libaray: Add Jar "Hive-jdbc-1.2.1-standalone"
  • Add class path for both jar.
Check Connection Status, If you have configured JAR correctly with exact version number of DB. It will work.


SOA Project configuration:
  • Create one SOA application.
  • Drag & Drop DB adapter
  • You can't use standard implementation like select/merge/insert of DB adapter due to non-support of HIVE into DB adapter so you have to go with "Pure SQL"

  • Before deployment you need to create Data source and connection factory in Weblogic console with name "eis/DB/Hive" and jdbc/Hive.
Weblogic Console configuration:


  • Copy both JAR's in SOA server and some accessiable location and add CLASSPATH entry in setDomainEnv.sh file and do a full bounce.
  • Unix classpath sample below.
  • POST_CLASSPATH="/home/Hive_Jar_For_Server/*****.jar${CLASSPATHSEP}/home/Hive_Jar_For_Server/*****.jar${CLASSPATHSEP}${POST_CLASSPATH}"

  • export POST_CLASSPATH

  • Full bounce Domain.

When you will start servers, You will notice Weblogic/Em console are not working, It's due to mutliple version of "commons-logging".
  • Oracle weblogic console app already have a different version of same.
  • Same "hive-jdbc-1.2.1-standalone" have a different version of same.
  • Two different version will generate issue.
  • To over come same issue we need find alternate JAR's for "hive-jdbc-1.2.1-standalone"(As this JAR is a combination of multiple JAR).
After spending 1 complete day, I got to know exact list of JAR's which will help us to connect with HIVE.
  • commons-logging-1.1.3
  • hadoop-common
  • hive-common-1.2.1
  • hive-jdbc-1.2.1
  • hive-metastore-1.2.1
  • hive-service-1.2.1
  • httpclient-4.5.2
  • httpcore-4.4.4
  • libthrift-0.9.2
I am suing 1.2.1 version for HIVE as it matches with my HIVE DB, you have to use same version with your HIVE DB.

Weblogic Console re-configuration:
  • POST_CLASSPATH="/Hive_Jar_For_Server/hadoop-common.jar${CLASSPATHSEP}/Hive_Jar_For_Server/hive-common-1.2.1.jar${CLASSPATHSEP}
  • /Hive_Jar_For_Server/hive-jdbc-1.2.1.jar${CLASSPATHSEP}/Hive_Jar_For_Server/hive-metastore-1.2.1.jar${CLASSPATHSEP}
  • /Hive_Jar_For_Server/hive-service-1.2.1.jar${CLASSPATHSEP}/Hive_Jar_For_Server/httpclient-4.5.2.jar${CLASSPATHSEP}
  • /Hive_Jar_For_Server/httpcore-4.4.4.jar${CLASSPATHSEP}/Hive_Jar_For_Server/libthrift-0.9.2.jar${CLASSPATHSEP}${POST_CLASSPATH}"
  • export POST_CLASSPATH
  • Full bounce Domain.
Data source configuration and DB adapter Connection factory:

  • Click on data source
  • Click new
  • Enter name and JNDI name

  • Click next
  • Click next
  • uncheck global transaction check box, As this driver does not support XA transaction.
  • Enter DB user name & password



  • Click on test configuration
  • if your class path is set correct and your machine have DB access it will be success message.
  • Finish the changes
  • Activate changes
  • Click one DB adapter connection factory by using newly created data source.
  • Deploy SOA POC application & test it.
  • Here is your output

Congrats!!! You did..

Post me if you face any issue



Comments

Post a Comment

Popular posts from this blog

Oracle SOA 12C rest adapter with Custom HTTP headers

Most existing web applications are connected through web services, which are commonly known as SOAP services. More and more users are relying on mobile devices for communication, and they’re looking for lighter ways to access enterprise information on the go. REST services are the answer for the mobile device platform, because they get rapid responses and fast access to data. Oracle SOA Suite 12 c  provides a complete set of service infrastructure components for designing, deploying, and managing composite applications. Oracle SOA Suite 12 c  enables services to be created, managed, and orchestrated into composite applications and business processes. Some time we have need to send HTTP headers in REST service, In OSB we use header component and add what ever is needed but in oracle SOA 12C it's little bit different. Let see how we can do it. Create one SOA Application. Create one SOA Sample project inside SOA Application. Go to composite and drag drop REST adapt

Dynamic Routing in OSB 12C

Dynamic Routing in OSB cab be used when the BusinessService endpoint required to be determine at runtime in message flow. Consider a scenario where OSB has to route the incoming requests to 2 different services based on the CustomerType element value sent in the payload. So create a XQuery resource with the following contents. Observe that we are using the absolute path of business service in configuration as required by dynamic routing. Following is the XML schema that we use:>>  Customer.xsd <?xml version="1.0" encoding="windows-1252" ?> <xsd:schema targetNamespace="http://xmlns.oracle.com/schema/Customer" xmlns:xsd="http://www.w3.org/2001/XMLSchema"             xmlns:ns1="http://xmlns.oracle.com/schema/Customer">   <xsd:complexType name="Customer">     <xsd:sequence>       <xsd:element name="CustomerId" type="xsd:string"/>       <xsd:elemen

Swagger API document from Any WADL & Schema in Oracle SOA

Hi everyone, Hope everyone is doing well these days, Recently i started a project work over how to generate swagger API document for your any REST API, In case if you don't know what is swagger please go and check " https://swagger.io/tools/swagger-editor/ ". It's a great and easy to use tool which will help to create user friendly, human readable form API documentation with extension for generating API client in different languages with capability of testing your API from same. What is swagger editor, Design, describe, and document your API on the first open source editor fully dedicated to OpenAPI-based APIs. The Swagger Editor is great for quickly getting started with the OpenAPI (formerly known as the Swagger Specification) specification, with support for Swagger 2.0 and OpenAPI 3.0.  What benefits you will get by using swagger, Runs Anywhere, The Editor works in any development environment, be it locally or in the web. Smart Feedback, Validate you