Link to home
Start Free TrialLog in
Avatar of mny
mny

asked on

Jdbc to Informix

Im trying to get any kind of connection to a Informix
database from a java applet. Im using version 7.24.
I have set CLASSPATH to the infromix.jar file and
LD_LIBRARY_PATH to sparc directory.

And when i try to run a javaprogram to access the database
I get:
ld.so.1: /pkg/java/jdk-1.1.5/bin/sparc/green_threads/java: fatal: libifdmi.so: can't open file: errno=2 (libIfmxLibmiNatives.so)
Exception occurred during event dispatching:
java.lang.UnsatisfiedLinkError: no IfmxLibmiNatives in shared library path
        at java.lang.Runtime.loadLibrary(Runtime.java)
        at java.lang.System.loadLibrary(System.java)
        at
        at
        at informix.api.direct.DirectCredentials.connection(DirectCredentials.java:166)
        at csql.createConnection(csql.java:96)
        at ExampleApplet.actionPerformed(ExampleApplet.java:250)
        at java.awt.Button.processActionEvent(Button.java:254)
        at java.awt.Button.processEvent(Button.java:227)
        at java.awt.Component.dispatchEventImpl(Component.java:1764)
        at java.awt.Component.dispatchEvent(Component.java:1704)
        at java.awt.EventDispatchThread.run(EventDispatchThread.java:63)
Can anyone help me with this problem???

/Mats
Avatar of mny
mny

ASKER

Edited text of question
Avatar of mny

ASKER

Edited text of question
ASKER CERTIFIED SOLUTION
Avatar of cph
cph

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of mny

ASKER

I shure have!
And by the way I missed out that i'm using Sun Solaris
/Mats
Java tries to load a dynamic library called "IfmxLibmiNatives.so". But this fails because you don't have a library path set up correctly. The library path is a list of directories that the Java runtime system searches when loading libraries.  To set up this under UNIX, the command is:

% setenv LD_LIBRARY_PATH directorypath

where directorypath is the name of the directory that contains the IfmxLibmiNatives.so library.

From what you wrote, I guess that this library is missing from your "sparc" directory. If not, be sure that the environment variable is available to the virtual machine that runs the applet. I don't remember if setenv only defines the environment for the shell the command is issued in. Be carefull about that. For example, try with an AppletViewer launched from the same shell that the one you used to define LD_LIBRARY_PATH.

You should note that you are going to face another problem with applets: you can't load dynamic libraries if the applet is not signed. But that's another problem.

Tell me if your problem is solved.
Avatar of mny

ASKER

Well fontaine.
I the file IfmxLibmiNatives.so is in the sparc directory
and the sparc directory is in my LD_LIBRARY_PATH
and i set the LD_LIBRARY_PATH in the same shell as
im trying to both compile and run the applet.
So what am I missing???

/mny
Did you look for the file libifdmi.so?

Avatar of mny

ASKER

Well cph im not shure what U mean.
I know where libifdmi.so is located and I have it in my path
(if that was what u meant)
/mny
Your installation seems OK. The problem is for sure with the LD_LIBRARY_PATH environment variable. Do you ever tried to use a dynamic library from a program on your system? Your problem is maybe not Java specific. Are you using a JIT ? If yes, turn it off. I have read that some JIT have problems with JNI.