clsql connect oracle database

1k views Asked by At

I am doing some practice with clsql. I want to connect my oracle server hence my connection function is;

(connect '("192.168.2.3" "xe" "username" "password") :database-type :oracle)

when i hit the return, the following error message shows up.

Couldn't load foreign libraries "libclntsh", "oci". (searched *FOREIGN-LIBRARY-SEARCH-PATHS*) [Condition of type SIMPLE-ERROR]

I have already installed oracle-instantclient11.2-basic-11.2.0.1.0-1.i386.rpm

and define export LD_LIBRARY_PATH=/usr/lib/oracle/11.2/client/lib

So, what else should I do to connect the server?

2

There are 2 answers

1
Laci Kosco On

I was playing with oracle lately and found out that all you need is to put path to libclntsh into /etc/ld.conf.d/oracle.conf

My setup was following( redhat,centos - as root): downloaded from oracle

oracle-instantclient12.1-basic-12.1.0.2.0-1.x86_64.rpm
oracle-instantclient12.1-devel-12.1.0.2.0-1.x86_64.rpm
install via rpm -ivh oracle*.rpm

Create file /etc/ld.so.conf.d/oracle.conf:

/usr/lib/oracle/12.1/client64/lib

then execute ldconfig

Now as clsql-oracle is not in quicklisp, I downloaded and extracted clsql-6.6.2, then

(require "asdf")
(push #P"/opt/jeff/clsql-6.6.2/" asdf:*central-registry*)
(asdf:load-system :clsql-oracle)
(defparameter *some-db* (connect '("127.0.0.1:1521/db1" "SOME_USER_RO" "*******") :database-type :oracle))

and voila, it works

1
Rob Marrowstone On

One thing that trips me up with dynamic linking to the Oracle libs (in C/C++ that is), is the fact that the libclntsh.so shared object comes with the version after the so name. So you may need to create a soft link in the same directory, ensuring that the soft link name is just libclntsh.so