1

I am running the following code but I am getting the error about the name of the Oracle class. I have set the classpath environment variable with the oracle jar file but it doesn't work. Somebody could help me? I have no idea what else to do. I really appreciate any help

This is the error : Caused by: java.sql.SQLException: Cannot load JDBC driver class 'oracle.jdbc.driver.OracleDriver'

import apache_beam as beam
from apache_beam.options.pipeline_options import PipelineOptions
from apache_beam.io.jdbc import ReadFromJdbc
import os;

os.environ["JAVA_HOME"] = "/home/jupyter/env/java/jre1.8.0_291"
os.environ["PATH"] = "/home/jupyter/env/java/jre1.8.0_291/bin"
os.environ["ORACLE_HOME"] = "/home/jupyter/env/instantclient_21_1/"
os.environ["CLASSPATH"] = "/home/jupyter/env/ojdbc6-11.2.0.4.jar" 
 
with beam.Pipeline(options=PipelineOptions()) as p:
      result = (p
          |  'Read from jdbc' >> ReadFromJdbc(
              fetch_size=None,
              table_name='log_table',
              driver_class_name='oracle.jdbc.driver.OracleDriver',
              jdbc_url='jdbc:oracle:thin://xx.x.xxx.xxx:xxxx/xxxxx',
              username='xxxxxxxx',
              password='xxxxxxxx',                  
          ))
         
  • 1
    Do the instructions from https://beam.apache.org/documentation/sdks/python-pipeline-dependencies/#nonpython help in any way? – Brent Worden Jun 07 '21 at 11:22

1 Answers1

0

could you please try the following suggestions?

  • Double-check the driver path location.
  • Validate the file permission, maybe it is necessary to execute as administrator.
  • Check that the database is up and running.
  • Validate port number and credentials.
  • Check this post, it contains great insights.
ovatleyva
  • 5
  • 5