I'm trying to connect to a SQLAnywhere 17 databas from Java. I have sajdbc4.jar in my classpath and I've added ../System/lib64 to my java.library.path. When I try to load the driver it fails trying to load a dependent library. Does anyone have an idea of what I might be doing wrong here ?

Exception in thread "main" java.lang.UnsatisfiedLinkError: /Applications/SQLAnywhere17/System/lib64/libdbjdbc17.dylib: dlopen(/Applications/SQLAnywhere17/System/lib64/libdbjdbc17.dylib, 1): Library not loaded: libdbtasks17_r.dylib Referenced from: /Applications/SQLAnywhere17/System/lib64/libdbjdbc17.dylib Reason: image not found at java.lang.ClassLoader$NativeLibrary.load(Native Method) at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1929) at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1847) at java.lang.Runtime.loadLibrary0(Runtime.java:870) at java.lang.System.loadLibrary(System.java:1119) at sap.jdbc4.sqlanywhere.IDriver.try_load(IDriver.java:485) at sap.jdbc4.sqlanywhere.IDriver.<clinit>(IDriver.java:423) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:408) at java.lang.Class.newInstance(Class.java:433) at java.util.ServiceLoader$LazyIterator.nextService(ServiceLoader.java:380) at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:404) at java.util.ServiceLoader$1.next(ServiceLoader.java:480) at java.sql.DriverManager$2.run(DriverManager.java:603) at java.sql.DriverManager$2.run(DriverManager.java:583) at java.security.AccessController.doPrivileged(Native Method) at java.sql.DriverManager.loadInitialDrivers(DriverManager.java:583) at java.sql.DriverManager.<clinit>(DriverManager.java:101) at Test.main(Test.java:8)

asked 31 Jan, 09:47

johan's gravatar image

johan
11121
accept rate: 0%


I will be assuming you have installed and set up the environment using the SQL Anywhere provided scripts but if that has not been done I would recommend starting with that focus first.

I suspect you are running one the latest MAC OS X operating systems (El Capitan or Sierra, ie. Mac OS X 10.11+) which has had a negative change to the DYLD_LIBRARY_PATH and LD_LIBRARY_PATH environment settings. To address that you will need include the SQL Anywhere lib64 (or lib32) directory in your -Djava.library.path=... ; as you have implied you may have already but worth rechecking.

Because of this evolving situation on Mac OS X, there have been numerous changes to the SQL Anywhere software (for this) so you do want to make sure you have applied a patch (any that brings the build number to 1356 or higher) that includes "Engineering Case" #793527.

The description of the fix can be found in the v16 and V12 Release Notes (EBF###_*_README.htm) files but the description for this fix is currently missing from the V17 one; I'm looking into getting that omission addressed.

permanent link

answered 31 Jan, 12:42

Nick%20Elson%20SAP%20SQL%20Anywhere's gravatar image

Nick Elson S...
6.4k2893
accept rate: 29%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×66
×64
×24

question asked: 31 Jan, 09:47

question was seen: 424 times

last updated: 31 Jan, 12:42