How to get MacOS Oracle ODBC client working with unixodbc? - oracle

I'm having a difficult time getting the Oracle 12.2.0.1.0-2 ODBC drivers and Instant Client (Basic Lite version) working with homebrew-installed unixODBC 2.3.5 under MacOS 10.12.6 (Sierra).
Extracting both of the Oracle ZIP files to /opt/ora12/instantclient_12_2, creating symlinks for libclntsh.dylib and libclntsh.dylib.12.1, then pointing odcb to the /opt/ora/12/instantclient_12_2/libsqora.lib gives a file not found error. While the path definitely exists and has good permissions, inspecting the dylib with otool -L shows that the #rpath directories are not finding the supporting libraries.
If I pull down the 12.2 sqlplus client, extract it to the same instantclient tree and run the binary, the CLI works fine. This seems to be some sort of dylib loading issue with odbc, but I'm not sure how to fix it. I've tried setting DYLIB_LIBRARY_PATH, copying all the libraries straight into /usr/local/lib, all to no effect.
I've not yet tried to pull out install_name_tool and hard coding search paths (getting further in the weeds than I've done before on MacOS) and I'm hoping something so drastic and non-portable isn't required. Is there a step to the install process I'm missing to get this working?
Thanks in advance!

After significant back and forth on the Oracle Community forums, the condensed solution is documented at this blog post: https://blogs.oracle.com/opal/installing-the-oracle-odbc-driver-on-macos?dd
In brief, the Oracle ODBC supplied odbc_update_ini.sh needs to be ran after first patching to change the reference from libsqora.so.12.1 to libsqora.dylib.12.1. Two libraries (libclntsh.dylib.12.1 and libclntshcore.dylib.12.1) then need to be symlinked into a library location on your PATH (I used /usr/local/lib).
With the above config (using the Basic client instead of Basic Lite, though Basic Lite should work) and the necessary tnsnames.ora black magic (TNS connection strings are covered in many other SO questions), I was able to connect both with command line isql and with my true goal, R's odbc and DBI using unixODBC.

Related

Oracle SOA Suite 11g installation problems

I am trying to install Oracle SOA Suite 11g but I face the following problem during installation. There are some prerequisites marked as failed. I am wondering why the overall result of the check is not executed. In addition, I have a problem starting the SOA managed server later.
I cannot see the "SOA" folder here
Clearly, if you ignore the checks and SOA does not appear something is broken. You need to tell us your OS version and make sure you adhere to the installation instructions here. My guess is you're on some linux distro. There are many files that need to be installed in many cases on linux to make this work.
I suggest, unless you have to install directly on your OS, to use a prebuilt virtual image to get up and running quickly.
SOA Suite 12c prebuilt is here. Install virtual box (free) and then follow download instructions exactly.
Here is 11g.
Oracle recommends ignoring the results of these checks for some of it's products, although I couldn't find a specific reference to SOA product, you can try to just go ahead and continue with the installation, hoping it will run successfully.
Here's is a reference to Oracle's reference for installation issues -
http://docs.oracle.com/cd/E23943_01/doc.1111/e14771/install.htm#BABCCGAB
You can find an instruction to ignore these errors under the 2.1.6 Oracle Universal Installer Issues section, although I'm not sure they apply in your case.

Lazarus OSX Lion "Can not load Oracle client library libociei.dylib"

Lazarus 1.2.4 (FPC 2.6.4)
Oracle XE 11.2
Oracle Instant Client 32bit (Basic & SqlPlus)
I have been able to use the Lazarus TOracleConnection in the designer to connect on Windows 7 and CentOS Linux. When attempting to do the same in OSX Lion I get "Can not load Oracle client library libociei.dylib. Is it installed?" It is located in /Library/Oracle/instantclient_11_2.
I am able to connect and query via sqlplus on the Mac. Here is the contents of my .bash_profile (paths are accurate):
DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:/Library/Oracle/instantclient_11_2
TNS_ADMIN=/Library/Oracle/instantclient_11_2/network/admin
PATH=$PATH:/Library/Oracle/instantclient_11_2
CLASSPATH=$CLASSPATH:$ORACLE_HOME
export DYLD_LIBRARY_PATH
export TNS_ADMIN
export PATH
export CLASSPATH
ORACLE_HOME is set to /Library/Oracle in Environment Variables
Can anyone tell why can't I connect through Lazarus running on OSX?
I'm neither knowledgable in Oracle nor OS X, so I just try to give some pointers:
Afaik the lazarus code just tries to dlopen('libociei.dylib').
So that either means
it can't find it because the lib has a different name (I assume you checked this)
it can't find it due to path issues (DYLD_LIBRARY_PATH should be ok, but temporarily try to set it globally in case a spawned process doesn't receive the changed env
it can't load it due to 32-bit vs 64-bit or other architectural reasons.
it can't load it due to other errors. (missing dependencies, security/permissions)
One can try to initialize the oracle module directly with a custom path.
Try using unit ocidyn in the lpr and then
do a
initialiseOCI('/your/whatever/path/libociei.dylib'); as first line in your .lpr
Note: If the error changed from "is it installed?" to "is it already loaded?", you are on to something, since you managed to load it at least once. I mention this because this subtle change often goes unnoticed.
My immediate workaround is to open Lazarus.app in Terminal. The designer works as advertised this way. The resulting .app can be run successfully from /Applications.

Issue installing Oracle SQL Developer on my MacBookPro - Am I missing a component?

I had to recently re-install OS X on my MBP and am in the process of re-installing all of my apps. One app that worked just fine in the past, but is now giving me errors is Oracle SQL Developer and I can't for the life of me figure out what I am missing.
Here's what I have tried:
Downloaded and installed SQL Developer on my machine.
Downloaded the Instant Client related files - http://www.oracle.com/technetwork/topics/intel-macsoft-096467.html (I installed all of the 64 bit related stuff on this page - Im on a 64 bit machine), combined it into one folder and moved it my /usr folder using this guide: installing Oracle Instantclient on Mac OS/X without setting environment variables?
I also installed this the JDK: http://www.oracle.com/technetwork/java/javase/downloads/index.html
I also set up my TNSNames.ora file and copied it to my /etc folder (This is required on a mac)
Here's my problem - If I attempt to connect to my Oracle instance using the above, it throws this error:
An error was encountered performing the requested operation:
no ocijdbc11 in java.library.path
Vendor code 0
This occurs whether I use basic or the TNS connection type.
So my question to my fellow developers is - Am I missing something in terms of the install above? I have tried googling for that particular error message and not found anything useful. At first glance, it seems like SQL Developer is looking for some file.
Thanks in advance for your answers!
EDIT - The version of SQL Developer that I am trying to install is 3.1.07 and I am trying to connect to an 11G instance.
Go to Tools > Preferences > Database > Advanced, and make sure Use OCI/Thick driver is un-checked.
Once done, try creating a connection and test. I also think you might be running an in-compatible version of Java in your newly installed OS X, so try installing JDK 1.6.0_11 or above, if the solution doesn't work.

Error when trying to connect R to PostgreSQL using RODBC

I am trying to connect to R using RODBC. However, when I run
ch <- odbcConnect("rails_dev", uid="skline", pwd="d0gsleep")
I get this error:
In odbcDriverConnect("DSN=rails_dev;UID=skline;PWD=d0gsleep") :
[RODBC] ERROR: state IM002, code 0, message [iODBC][Driver Manager]Data source name not found and no default driver specified. Driver could not be loaded
Any thoughts? I am new to this and at a loss for what to do next... thank you so much in advance!'
Note I am using Mac OSX
EDIT: The answer below is outdated, as some of the mentioned packages aren't available on CRAN any longer. I leave it here for reference.
More recent info can be found in the following question:
How to connect R with PostgreSQL on OSX 10.10.2?
For connection to PostgreSQL on Mac, you can use the package RpgSQL. Be sure to read the installation notes, as your PostgreSQL installation has to be set up for using JDBC. This is by far the easiest way. If you install PostgreSQL, you fire up the Stack Builder at the end of the installation process to do so (see the installation guide). Alternatively, you can use the Stack Builder (included in the postgreSQL installation) after installation to add extra components. Under Database drivers you should find postgresql JDBC.
The rdbi package mentioned in the comments, is removed from CRAN and afaik not maintained any more.
If you really need to use ODBC, you need a driver for PostgreSQL, and it has to be known to the ODBC implementation on your computer. The driver Jim M. gave you is one option, another one is the drivers of Openlinksw or the "official" one on pgFoundry. Normally, you should be able to download an ODBC driver from Stack Builder like you do for a JDBC driver : under the heading database drivers you have a postgresql ODBC as well.
For the newest versions of OSX, you need to install your own odbc manager apparently. Next to the one Eelke mentioned in the comments, you have the one from Apple as well here. In this manager, you can specify the driver location etc, and set up the connection to PostgreSQL through ODBC. How to do this, is dependent on the manager you use and is explained in the help files. It's always interesting to read the relevant section in the FAQ of iODBC and the sections on ODBC on Mac.
On a sidenote : In R, You can check which DSNs can be found by using the command odbcDataSources() of the RODBC package. If Postgresql is not mentioned in there, you know you have to look at your setup first.
Depending on the database you want to connect to, Actual Technologies has drivers for Mac OSX for open source databases (MySQL, PostgreSQL), Oracle, as well as Microsoft Access, etc, and costs about $35. Setup in ODBC administrator is straightforward whether you want to create a connection for all users on the machine (System DSN) or for user-specific level as there is a wizard that will walk through basic steps.

Getting Toad 9.7 to work on Windows 7 x64

I'm trying to get Toad 9.7 to work on a new installation of Windows 7 x64. I installed a 64-bit Oracle instant client (manually by extracting to a folder and setting some environment variables). Things seemed to be OK (SQL Developer worked, SQL*Plus worked), but Toad was having problems.
I then read that Toad needs a 32-bit client, so I "installed" that using the same method, but it still wasn't happy. It kept giving me an error saying that I didn't have an Oracle client installed. I tried many different things like setting different environment variables (LD_LIBRARY_PATH, ORACLE_HOME etc.) and nothing worked. I then scrapped the manual method and downloaded the full Oracle client but only checked the "instant client" option when I ran the setup, and that finally worked. Toad recognized the client and I got rid of those env. variables I had set, and only had TNS_ADMIN set, in addition to the oracle home folder in the system path.
There was still one problem. Toad didn't know the version of my oracle client and kept giving me error messages saying that the oracle home was invalid. I could ignore those messages and everything seemed to work, but I just didn't like the fact that the home it was using was coloured red and I had to tell it to ignore those error messages.
So after a little more digging and some guesses on my part, I got a kludge-ey method to work. I copied the oci.dll file into the bin folder under the oracle home, and I also made another copy of that file in the bin folder and called it oraclient11.dll. The combination of those two things got Toad to stop complaining.
However, that doesn't seem like a very clean method, so I was wondering if anyone else has come across this issue and used a cleaner method to get it working.
After you install the 32-bit client by extracting the files, set the PATH to point to the 32-bit directory. And make sure that the 32-bit directory is in the path BEFORE the 64-bit directories.
I think that's what worked for me but I'm not 100% positive.

Resources