Troubleshooting “Cannot Find Library File: System.Data.CData.OracleOCIw.dll" Error on Linux/Ubuntu

  • 11 June 2024
  • 0 replies
  • 35 views

Userlevel 2
Badge

This article contains detailed steps for resolving the mentioned error that most of our customers face as they download the Oracle driver. This specifically focuses on Connect Servers installation on Linux systems (Ubuntu) 

Typically, the OCI files are automatically downloaded when you install the Oracle Connector within Connect Server. These files are usually located in Home/opt/cdata/connect/lib, depending on where you extracted the folder on your Linux system. 

 

Please note that inside this folder, there are two different directories: x64 and x86. Be sure to copy the path to the appropriate directory. For instance, in my case, it is Home/opt/cdata/connect/lib/x64. 

 

 

**Note: ** It is important to extract these folders inside /opt/cdata/connect, as placing them elsewhere can sometimes cause permission issues when running the application as a service. 

 

Once you have copied the path, you need to save it as an LD_LIBRARY_PATH on your Linux system.  

Depending on how you are running the application, this LD_LIBRARY_PATH must be specified in two different files: 

A. Running as a Process – Add the path inside the .bashrc file. 

B. Running as a Service – Add the path inside the cdata-connect.service file for the user running the service. 

 

I have detailed the entire process of adding this path for both cases below. 

 

Running as a Process: 

First, access the .bashrc file located in the home directory of the root user. You can do this by running the command vim ~/.bashrc in the terminal. Once the file is open, add the LD_LIBRARY_PATH as shown below and in the screenshot: 

export LD_LIBRARY_PATH=/home/rohit/Downloads/CDataConnect/lib/Oracle0ci/x64 

 

Second, after adding the path, reload the .bashrc file for the current shell session using the command  source ~/.bashrc This will apply the changes without needing to close and reopen the terminal. 

Lastly, open the application using the following command :java -jar connect.jar -f service.json. 

 

NOTE: There are some additional aspects that a user needs to make sure during this entire process: 

1. the application should be closed while updating the .bashrc file 

2. Access the application as a root user to ensure you have the necessary access rights and permissions. 

 

                                     Running as a Service. 

When running the application as a service, first ensure that you have created a daemon for your service by executing the bash ./service command, which will create a daemon called cdata-connect.service 

For more information on the same, please refer to the “Running Connect as a Service”: https://cdn.cdata.com/help/BWH/connect/Starting-Server.html#running-connect-as-a-service 

This file is typically located at /etc/system/system/cdata-connect.service  

Once created, open the cdata-connect.service file and add the LD_LIBRARY_PATH as an Environment variable under the Service section as follows: 

 

Environment=”LD_LIBRARY_PATH=/opt/cdata/connect/lib/OracleOci/x64” 

 

 

Once done, reload the daemon using the `systemctl daemon-reload` command. Finally, restart the service, and the error should be resolved. 

 

Hope this helps! 


This topic has been closed for comments