Question

I am getting a strange behaviour by Oracle ODBC driver under linux (unixODBC).

I have a program connecting to a database that, when called by an unprivileged user, works as expected while if called with root privileges (tested with both sudo and su) hangs in the SQLDriverConnect call then dies after some minutes (returning code 1) without an error message or anything.

I'm using system DSN and the same exact configuration (only difference is root privileges) and, to make things more funny, I also use the same code to connect to a postgreSQL database with no issue at all both with unprivileged and root user (hence it would not appear to be an unixODBC issue).

Any idea if it can really be the cause of the problem for the Oracle driver or hint on its resolution?

Oracle Driver version: oracle-instantclient11.2-odbc-11.2.0.1.0-1.x86_64

Was it helpful?

Solution

Well, to answer my own question,

The answer is No, root privileges are not the cause of the issue: environment variables are.

Switching to user root does not keep the ORACLE_HOME environment variable; setting it allows the driver to work properly.

In conclusion it would appear that, in spite of having the full path to the driver itself into the odbc configuration, the Oracle driver still requires that environment variable to work properly. Moreover it does not give any hint on the cause of the failure.

Takeaway: is something is not working with your Oracle (anything from the server itself to the most remote of its components), first thing to do is double-check the environment.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top