Forum Discussion

Jaganath's avatar
Jaganath
Frequent Visitor
1 year ago
Solved

Integration with UniVerse database

Hi Everyone,   Good day. Just checking here. My client has given a hint that they have the data stored UniVerse database. Does anyone know how to integrate with fabric and extract the data seemless...
  • Anonymous's avatar
    Anonymous
    1 year ago

    Hi Jaganath,

    Here is some code about jdbc driver in notebook that modify from sample of other datasource, you can take a look on it if helps: (notice: you need to upload the driver file to the environment before use these)

    from pyspark.sql import SparkSession
    
    #Initialization SparkSession
    spark = SparkSession.builder \
        .appName("UniVerseConnection") \
        .config("spark.driver.extraClassPath", "/path/to/your/uploaded/UniVerse") \
        .getOrCreate()
    
    #Use a JDBC connector to connect to the UniVerse database
    jdbc_url = "jdbc:universe://hostname:port/database"
    
    #Configure the connection string with credentials and database details
    connection_properties = {
        "user": "your_username",
        "password": "your_password",
        "driver": "com.universe.jdbc.Driver"
    }
    
    #Use the Spark DataFrame to read data
    df = spark.read.jdbc(url=jdbc_url, table="your_table_name", properties=connection_properties)
    df.show()

    Regards,

    Xiaoxin Sheng