title: Loading data from ADLS Gen 2 into Azure Synapse
body: <p>I am trying to load Parquet files from ADLS Gen2 to Synapse using polybase external table feature. </p>
  
  <p>Below is the code, but when running the create external table command, the query never completes. On cancelling the query execution, i see this error -</p>
  
  <p><strong>External file access failed due to internal error: 'Error occurred while accessing HDFS: Java exception raised on call to HdfsBridge_IsDirExist. Java exception message:
  HdfsBridge::isDirExist - Unexpected error encountered checking whether directory exists or not: UnknownHostException: ''.azuredatalakestore.dfs.core.windows.net'</strong></p>
  
  <p><strong>SQL query</strong> </p>
  
  <pre><code>CREATE MASTER KEY ENCRYPTION BY PASSWORD = '&lt;password&gt;';
  GO
  
  DROP CREDENTIAL ADLSCredential
  CREATE DATABASE SCOPED CREDENTIAL ADLSCredential
  WITH
      IDENTITY = 'user',
      SECRET = '&lt;secret-key&gt;'
  ;
  
  CREATE EXTERNAL DATA SOURCE AzureDataLakeStorage
  WITH (
      TYPE = HADOOP,
      LOCATION = 'abfss://&lt;container&gt;@&lt;storage-account&gt;.azuredatalakestore.dfs.core.windows.net',
      CREDENTIAL = ADLSCredential
  );
  
  -- Create an external file format for PARQUET files.  
  CREATE EXTERNAL FILE FORMAT parquet  
  WITH (  
      FORMAT_TYPE = PARQUET,  
      DATA_COMPRESSION = 'org.apache.hadoop.io.compress.SnappyCodec'  
  ); 
  
  CREATE EXTERNAL FILE FORMAT uncompressedcsv
  WITH (
      FORMAT_TYPE = DELIMITEDTEXT,
      FORMAT_OPTIONS (
          FIELD_TERMINATOR = ',',
          STRING_DELIMITER = '',
          DATE_FORMAT = '',
          USE_TYPE_DEFAULT = False
      )
  );
  
  CREATE EXTERNAL TABLE [dbo].[CashReceipts_external] (
      [AMOUNT_APPLIED] [float] NOT NULL,
      [TRX_NUMBER] [nvarchar](50) NULL,
      [SHORT_NAME] [nvarchar](50) NOT NULL,
      [NAME] [nvarchar](1) NULL,
      [CURRENT_RECORD_FLAG] [nvarchar](50) NULL,
      [CURRENCY_CODE] [nvarchar](50) NULL,
      [FUNC_CURRENCY_CODE] [nvarchar](50) NOT NULL,
      [CASH_RCPT_AMOUNT] [float] NULL,
      [CASH_HISTORY_AMOUNT] [float] NULL,
      [FUNC_AMT_HISTORY] [float] NULL,
      [STATUS] [nvarchar](50) NULL,
      [ANTICIPATED_CLEARING_DATE] [nvarchar](50) NULL,
      [CASH_HISTORY_EXCHANGE_RATE] [nvarchar](50) NULL,
      [GL_DATE] [datetime2](7) NULL,
      [GL_PERIOD] [datetime2](7) NOT NULL,
      [BATCH_GL_DATE] [nvarchar](1) NULL,
      [EXCHANGE_RATE] [nvarchar](50) NULL,
      [RECEIPT_NUMBER] [nvarchar](50) NULL,
      [DEPOSIT_DATE] [datetime2](7) NULL,
      [RECEIPT_DATE] [datetime2](7) NULL,
      [ISSUE_DATE] [nvarchar](1) NULL,
      [TYPE] [nvarchar](50) NULL,
      [GL_POSTED_DATE] [datetime2](7) NULL,
      [AMOUNT] [float] NULL
  )
  WITH
  (
      LOCATION='parquetfiles'
  ,   DATA_SOURCE = AzureDataLakeStorage
  ,   FILE_FORMAT = parquet
  ,   REJECT_TYPE = VALUE
  ,   REJECT_VALUE = 0
  )
  ;
  </code></pre>