4

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?

haluk
  • 1,148
  • 2
  • 9
  • 19
  • What operating system? What Lisp compiler? How is CLSQL installed (asdf-install, clbuild, etc)? – Ken Aug 28 '10 at 15:28
  • When I had trouble connecting to MySQL, part of the trouble was word length: the OS, Lisp, and MySQL libraries were a mix of 32- and 64-bit. (I never got it to work completely, but fixing this at least caused it to fail later in the process!) – Ken Aug 28 '10 at 15:29
  • I am using linux (fedora 13), my lisp interpreter is sbcl and i installed clsql by clbuild. I also got similar error with mysql as well. – haluk Aug 29 '10 at 01:22
  • Do the files mentioned in the error message exist somewhere on your system? If so, where? And are the directories where these files exist (if they do) in FOREIGN-LIBRARY-SEARCH-PATHS, which I suspect is a collection of some sort in your LISP environment? – Bob Jarvis - Слава Україні Apr 27 '11 at 12:18

2 Answers2

2

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

Laci Kosco
  • 61
  • 1
  • 7
1

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

Rob Marrowstone
  • 1,224
  • 8
  • 15
  • I think this should be part of my answer, thanks for pointing out - sometimes you simply have everything but the name of the '.so'' file correct, because it has specific oracle version included. Some packages have that thing ready for you, some do not - like on debian, and early oracle's *.rpm. So definitely, if you created ldconfig entry, and it is still not working, check name of libclnt.so file or link presence – Laci Kosco Jun 08 '20 at 08:06