Issues Connecting to Infor Data Lake Using Spark JDBC in Azure Synapse Spark Notebook

Sriram M 20 Reputation points
2024-07-04T09:19:18.87+00:00

Hi Team,

I'm encountering difficulties while attempting to connect to Infor Data Lake using Spark JDBC within Azure Synapse. Despite configuring the necessary JDBC driver and ionapi file path, I consistently encounter the following error:

"Py4JJavaError: An error occurred while calling o3997.jdbc.

: java.lang.RuntimeException: JDBC Error 100

Unable to connect. The Infor Compass JDBC Driver.ionapi file is not found. The file must be located in the folder containing the Compass JDBC driver JAR file."

Setup Details:

I've initialized my Spark session in Azure Synapse with the required JDBC driver and specified the ionapi file path using spark.jars.

The ionapi file is stored in Azure Data Lake Storage (ADLS), and I have ensured the path is correctly specified in the JDBC connection properties.

Code Snippet:

%%configure -f

{

"conf": {  

    "spark.jars": "abfss://container@datalake_name.dfs.core.windows.net/infor-compass-jdbc-2023.10.jar",  

}  

}

storage_account_name = "**"

container_name = "**"

jdbc_jar_path = f"abfss://{container_name}@{storage_account_name}.dfs.core.windows.net/path_to_jdbc_driver/infor-compass-jdbc-2023.10.jar"

ionapi_file_path = f"abfss://{container_name}@{storage_account_name}.dfs.core.windows.net/path_to_ionapi_file/Infor Compass JDBC Driver.ionapi"

spark = SparkSession.builder \

.appName("InforDataLakeConnection") \

.config("spark.jars", jdbc_jar_path) \

.getOrCreate()

jdbc_url = "jdbc:infordatalake://your_infordatalake_endpoint"

jdbc_properties = {

"user": "**",

"password": "**",

"driver": "com.infor.idl.jdbc.Driver", 

"ionapi": ionapi_file_path 

}

table_name = "table_name"

df = spark.read.jdbc(url=jdbc_url, table=table_name, properties=jdbc_properties)

df.show()

Error Analysis:

I have verified that ionapi_file_path correctly points to the location of the ionapi file in ADLS.

The storage account key used in spark.conf.set matches the correct ADLS storage account.

Request for Assistance:

Could you please provide guidance on how to correctly configure the ionapi file path or any additional settings necessary to successfully connect to Infor Data Lake using Spark JDBC in Azure Synapse?

Azure Synapse Analytics
Azure Synapse Analytics
An Azure analytics service that brings together data integration, enterprise data warehousing, and big data analytics. Previously known as Azure SQL Data Warehouse.
4,652 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Vijayakumar Konduru 0 Reputation points
    2024-07-08T17:42:56.02+00:00

    Hi,

    Thanks for your response.

    Tried all approaches.

    jdbc_jar_path = "abfss://container@storageacoount.dfs.core.windows.net/pipeline_dev/wms/infor-compass-jdbc-2023.10.jar" # Path in your storage account

    ionapi_path = "abfss://container@storageacoount.dfs.core.windows.net/pipeline_dev/wms/Infor Compass JDBC Driver.ionapi" # Path in your storage account

    key='xxxxx'

    from notebookutils import mssparkutils

    #from mssparkutils import fs

    ionapi_file_path = "abfss://container@storageacoount.dfs.core.windows.net/pipeline_dev/wms/Infor Compass JDBC Driver.ionapi"

    local_ionapi_path = "/tmp/Infor Compass JDBC Driver.ionapi"

    mssparkutils.fs.cp(ionapi_file_path, local_ionapi_path)

    //download_file method not available in fs package

    from pyspark.sql import SparkSession

    spark = SparkSession.builder \

    .appName("InforDataLakeConnection") \

    .config("spark.jars", jdbc_jar_path) \

    .config("spark.executor.extraClassPath", "abfss://container@storageacoount.dfs.core.windows.net/pipeline_dev/wms/") \

    .getOrCreate()

    jdbc_properties = {

    "user": "",
    
    "password": "",
    
    "driver": "com.infor.idl.jdbc.Driver",
    
    "ionapi": local_ionapi_path
    ```}
    
    jdbc_url="jdbc:infordatalake://tenant_id"
    
    table_name = "xxxxx"
    
    # 
    
    df = spark.read.jdbc(url=jdbc_url, table=table_name, properties=jdbc_properties)
    
    after trying he above code we are facing the same issue in pyspark notebook.
    
    the file must be located in the folder containing the Compass JDBC driver JAR file."
    
    Is there any otherway we can call python script from synapse notebook level.  Please suggest