Forum Discussion
Integration with UniVerse database
- Anonymous1 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
HI Jaganath,
I checked these on fabric side but not found the official data connectors. For this scenario, perhaps you need to use REST API or other type of data drivers with connection string to get data.
Regards,
Xiaoxin Sheng
Hi Anonymous ,
Thanks for checking. Much appreciated.
- Anonymous1 year agoNot applicable
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