cancel
Showing results for 
Search instead for 
Did you mean: 
Data Engineering
cancel
Showing results for 
Search instead for 
Did you mean: 

Databricks to Oracle

Raghu101
New Contributor III

How to write data from Databricks SQL to Oracle DB

1 ACCEPTED SOLUTION

Accepted Solutions

Ajay-Pandey
Esteemed Contributor III

Hi @Raghu G​ please refer below code -

Image 

View solution in original post

6 REPLIES 6

Ajay-Pandey
Esteemed Contributor III

Hi @Raghu G​ please refer below code -

Image 

Raghu101
New Contributor III

Thank you

Kaniz
Community Manager
Community Manager

Hi @Raghu G​, It would mean a lot if you could select the "Best Answer" to help others find the correct answer faster.

This makes that answer appear right after the question, so it's easier to find within a thread.

It also helps us mark the question as answered so we can have more eyes helping others with unanswered questions.

Can I count on you?

Meghala
Valued Contributor II

@Raghu101 thanks this answer helped me

ramravi
Contributor II

we can use JDBC driver to write dataframe to Oracle tables. Every database will use jdbc connect to connect & access database. You can follow same process for connecting to any database.

Download Oracle ojdbc6.jar JDBC Driver

You need an Oracle jdbc driver to connect to the Oracle server. The latest version of the Oracle jdbc driver is ojdbc6.jar file. You can download the driver version as per your JDK version.

You can download this driver from official website. Go ahead and create Oracle account to download if you do not have. Or can download from maven as dependent library in cluster or job directly

In the Databricks Clusters UI, install your third-party library .jar or Maven artifact with Library Source 

Upload DBFS, DBFS/S3 or Maven. Alternatively, use the Databricks libraries API.

install-library 

Load Spark DataFrame to Oracle Table Example

Now the environment is se. we can use dataframe.write method to load dataframe into Oracle tables.

For example, the following piece of code will establish JDBC connection with the Oracle database and copy dataframe content into mentioned table.

Df.write.format('jdbc').options(
 
      url='jdbc:oracle:thin:@192.168.11.100:1521:ORCL',
 
      driver='oracle.jdbc.driver.OracleDriver',
 
      dbtable='testschema.test',
 
      user='testschema',
 
      password='password').mode('append').save()
 

Hello, im having a hard time connecting to an oracledb.

I downloaded the driver and installed it.

however, if i tried this.

oracledb.connect("credshere")

it does not work.

am i missing something here?​

Welcome to Databricks Community: Lets learn, network and celebrate together

Join our fast-growing data practitioner and expert community of 80K+ members, ready to discover, help and collaborate together while making meaningful connections. 

Click here to register and join today! 

Engage in exciting technical discussions, join a group with your peers and meet our Featured Members.