Is there the possibility of a Pure Perl DBI connection of some kind to an Oracle database? I'm trying to allow for running queries from many different servers of different architectures and avoid worrying about the specific architecture (e.g. Linux or AIX or Solaris), matching the specific installation location for the Perl modules on every server (the location of my HOME directory varies on different servers), the need to install an Oracle Instant Client on every server, and most especially, the need to do a source install of DBI and DBD::Oracle on each server.
I'm imagining something like the following:
Build and install DBI on a server (with an installed compiler) inside a local::lib environment
Build and install some kind of pure perl DBD driver (or maybe use one of the built-in DBD drivers?)
Copy only the directory structure and the .pm files to a target server
On the target server, run queries against an Oracle database using local::lib to find the modules and DBI_PUREPERL=2 to avoid the need for the .so libraries.
What kind of DBD driver would work in this scenario? JDBC or ODBC maybe?
Or should I just give up and perform a from-source installation of DBI and DBD::Oracle on sample servers of all the various architectures and then create some kind of installation package of the DBI/DBD modules + Oracle's Instant Client for the each different architecture? (Bonus points if I can avoid setting LD_LIBRARY_PATH to get Oracle's Instant Client to work.)
Thoughts?
Related
I'm trying to connect to a db2 using golang using https://bitbucket.org/phiggins/db2cli. While trying to follow the instructions, I run into this error
vendor/bitbucket.org/phiggins/db2cli/api/api_unix.go:12:11: fatal
error: 'sqlcli1.h' file not found
#include <sqlcli1.h>
^~~~~~~~~~~
1 error generated.
This is the script I tried to use
#!/bin/bash
DB2HOME=$HOME/sqllib
export CGO_LDFLAGS=-L$DB2HOME/lib
export CGO_CFLAGS=-I$DB2HOME/include
go install .
Could someone point me to what I need to do to use db2cli? I'm running this code on a macbook.
To build golang with the phiggins db2cli , your workstation or server needs to have a Db2 product (e.g. a suitable client, or a server package) installed locally specifically to deliver the INCLUDE files and the library files for development with Db2.
The Db2-client software comes in different packages for different purposes, and a Db2-client also comes with a Db2-LUW server. For development purposes (i.e. to compile and link executable programs) you need the "IBM Data Server Driver package".
IBM describes the different Db2 client types at this link.
If your remote Db2-server runs on Linux/Unix/Windows, you can also try building golang-db2cli on that hostname and copy the build-targets to your workstation provided the server and workstation run the same distro and bitness and release and that the Db2 version/fixpack is identical to that of the client.
Otherwise you can download and install the relevant package from IBM's Fix Central website (registration required) , or from IBM's Passport Advantage website for registered entitled customers. The Db2-client download links are available currently at this link.
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.
We need to distribute a tool which is developed using Python, Java and MySQL as database in a distributable format.
So if end user is installing our tool, we check for Python, and if it not exists then we would install Python from the disk and not from apt-get. The process repeats for Java and MySQL which are run as sub-process, so that everything happens in sequence.
We could have used Docker images, but it runs in a container and we would not like our application to run within a restricted environment. Is this understanding correct that we would not have complete access to 100% of the resources in case of Docker?
What should be our approach and if anybody can share their experience in creating such distributable would be highly appreciated.
I have a program using odac(11.2) and oracle client 11.2. Now I want to deploy it to a box which is already installed a oracle 9i client.
Some existing programs is depend on it so I fear the new client will harm the existing program. Is this true? And how can I keep them all working properly?
Normally you install oracle products in a dedicates ORACLE_HOME in different directories (like /ora/app/oracle/product/9.2 and /ora/app/oracle/product/11.2). Then you set the $ORACLE_HOME and $PATH variables to that directory which will be working fine.
We use many different client versions from 8.1.6 to 11.2 on one machine. Every application has an own shell script setting up the correct environment prior to starting.
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.