Thursday, December 04, 2014

TTransportException SocketTimeoutException - Hive - Azure HDInsight Emulator

While working on Hive in Azure HDInsight Emulator I was not able to create database and following exception was being thrown with all the queries:

FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask. MetaException(message:Got exception: org.apache.thrift.transport.

To resolve the issue and assuming Hadoop installation folder is C:\hdp open hive-site.xml from:
C:\hdp\hive-....*\conf directory

Locate

  javax.jdo.option.ConnectionDriverName
  org.apache.derby.jdbc.CommonDriver
  Driver class name for a JDBC metastore


and change CommonDriver to EmbeddedDriver:

  javax.jdo.option.ConnectionDriverName
  org.apache.derby.jdbc.EmbeddedDriver
  Driver class name for a JDBC metastore


From Services restart Apache Hadoop Metastore service and retry running HQL queries. It should work not. In case issue cannot be resolved feel free to drop me an email or comment.

Thursday, July 03, 2014

ODP.NET Managed Data Access (Oracle.ManagedDataAccess.dll) with Enterprise Library

Oracle.ManagedDataAccess.dll is managed Oracle connector that doesn't require any Instant Client to be installed and offers advantage over unmanaged counterparts. It doesn't require any installation on the machine and Oracle.ManagedDataAccess.dll should be placed in execution directory or in probing directory specified in configuration.

Below are the two errors which you may receive while trying to use Oracle Managed Data Access DLL:

1. Activation error occured while trying to get instance of type Database, key ""

Resolution of the dependency failed, type = Microsoft.Practices.EnterpriseLibrary.Data.Database, name = ConnectionString.
Exception occurred while: while resolving.
Exception is: InvalidOperationException - The type Database cannot be constructed. You must configure the container to supply this value.-----------------------------------------------
At the time of the exception, the container was: Resolving  Microsoft.Practices.EnterpriseLibrary.Data.Database,ConnectionString (this occurs when wrong provider factory is used or DbProviderFactories hasn't been added to the application configuration or machine.config)


2. Configuration system failed to initialize (this occurs when configuration section doesn't have correct entry)

Solution:
To make Oracle.ManagedDataAccess.dll work with Enterprise Library few additional obvious configuration changes are required:

 Add configSections section at the top of configuration:
<configSections> <section name="oracleConnectionSettings" type="Microsoft.Practices.EnterpriseLibrary.Data.Oracle.Configuration.OracleConnectionSettings, Microsoft.Practices.EnterpriseLibrary.Data, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="true" /> <section name="dataConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Data.Configuration.DatabaseSettings, Microsoft.Practices.EnterpriseLibrary.Data, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="true"/> <section name="oracle.manageddataaccess.client" type="OracleInternal.Common.ODPMSectionHandler, Oracle.ManagedDataAccess, Version=4.121.1.0, Culture=neutral, PublicKeyToken=89b483f429c47342" /> </configSections>


Add Db Provider Factories:

In case of ODP.NET to load appropriate factory while creating database machine.config is modified during installation and DbProviderFactories is added however with Oracle.ManagedDataAccess.dll there is no installation required so edit the application configuration file (app.config or web.config) and add following:
<system.data> <DbProviderFactories> <remove invariant="Oracle.ManagedDataAccess" /> <add name="Oracle Managed Data Provider for .NET" invariant="Oracle.ManagedDataAccess" description="Oracle Managed Data Provider for .NET" type="Oracle.ManagedDataAccess.Client.OracleClientFactory, Oracle.ManagedDataAccess, Version=4.121.1.0, Culture=neutral, PublicKeyToken=89b483f429c47342" /> </DbProviderFactories> </system.data>


Make sure to change the version and Public Key Token depending on the version being used.


Connection string for EZConnect looks like:
<connectionStrings> <add name="ConnectionString" connectionString="Data Source=//localhost:1521/Shash;User ID=scott;Password=tiger;" providerName="Oracle.ManagedDataAccess" /> </connectionStrings>

Above configuration changes allow use of Oracle.ManagedDataAccess.dll with Enterprise Library.