Please be aware that the content in SAP SQL Anywhere Forum will be migrated to the SAP Community in June and this forum will be retired.

Good day for you!

When i try to connect to the database with sajdbc.jar driver i get error message "no dbjdbc17 in java.library.path: /Applications/SQLAnywhere17/System/lib64:...".

System.setProperty("java.library.path","/Applications/SQLAnywhere17/System/lib64/");

Connection con = DriverManager.getConnection(
        "jdbc:sqlanywhere:" +
                "UserID=dba;" +
                "Password=sql;" +
                "Host=127.0.0.1:2638;" +
                "ServerName=srvname;" +
                "DatabaseName=dbname;"
);

This issue only in macos and linux. In windows the same code works perfectly.

echo $SQLANY17

/Applications/SQLAnywhere17/System

ls -l /Applications/SQLAnywhere17/System/lib64/ | grep libdbjdbc17

-r-xr-xr-x 1 user admin libdbjdbc17.dylib

Using jconn4.jar driver give the next error: "SQL Anywhere Error -103: Invalid user ID or password 010HA: The server denied your request to use the high-availability feature. Please reconfigure your database, or do not request a high-availability session."

Does anyone know how to solve this problems?

asked 01 Mar '23, 10:22

mrV's gravatar image

mrV
41237
accept rate: 0%

edited 01 Mar '23, 14:12

If I source sa_config.sh, I am able to load the library. Otherwise, I see the behaviour that you report. There must be an environment element that must be defined - typically $SQLANY17 but I have tried that with no luck. Note that on MacOS 10.11, the full path to the library must be used (as documented). Is there a reason to not use sa_config?

(02 Mar '23, 11:49) Chris Keating
Replies hidden

sa_config was called earlier. Unfortunately it doesn't help.

(03 Mar '23, 03:22) mrV

I have the same problem.. I want to make a report using BIRT (eclipse) and I get the same error. I'm working in macOS

(03 Mar '23, 10:03) mandres

If you have sourced the environment with sa_config.sh (assuming BASH), the java.library.path should not need to be changed (comment out that line).

Can you check

 ldd $SQLANY17/lib64/libdbjdbc17.so

to see if all shared objects are resolved?

and ensure that LD_LIBRARY_PATH is defined as per the sa_config. And also check in the java app by checking the value with:

System.getProperty( "java.library.path" );
(03 Mar '23, 13:48) Chris Keating
Replies hidden

FWIW, do you mean the script has been "called" or really be "sourced", as that is an important difference?

(06 Mar '23, 03:08) Volker Barth
cat ~/.zshrc | grep sa_config

source /Applications/SQLAnywhere17/System/bin64/sa_config.sh

otool -L $SQLANY17/lib64/libdbjdbc17.dylib

/Applications/SQLAnywhere17/System/lib64/libdbjdbc17.dylib: @rpath/libdbjdbc17.dylib (compatibility version 0.0.0, current version 0.0.0) @rpath/libdbtasks17_r.dylib (compatibility version 0.0.0, current version 0.0.0) /usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 800.6.0) /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1281.0.0)

echo $LD_LIBRARY_PATH

/Applications/SQLAnywhere17/System/lib64:

String library_path = System.getProperty( "java.library.path" );
System.out.println("library_path = " + library_path);

library_path = /Applications/SQLAnywhere17/System/lib64:/Applications/SQLAnywhere17/System/lib64:/Users/mrjill/Library/Java/Extensions:/Library/Java/Extensions:/Network/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java:.

(06 Mar '23, 09:12) mrV
showing 3 of 6 show all flat view

The error message "no dbjdbc17 in java.library.path" indicates that the Java Virtual Machine (JVM) is unable to locate the SQL Anywhere JDBC driver's native library. The native library is a platform-specific dynamic link library (DLL) or shared object file that provides the driver's native method implementation.

To resolve this issue, use the following command before initiating the connection to add the directory containing the native library to the JVM's library path:

System.setProperty("java.library.path", "/Applications/SQLAnywhere17/System/lib64/");

You may also try passing the library path as a command-line input to the JVM when launching it:

java -Djava.library.path=/Applications/SQLAnywhere17/System/lib64/ YourMainClass

If you continue to receive the "Invalid user ID or password" error while using the jconn4.jar driver, it is likely that the user ID or password you are using is wrong, or that the database server is not configured to support high-availability connections. You can try connecting to the database server with the same user ID and password that you use with other tools or clients. You may also look for any error messages linked to the high-availability functionality in the database server logs.

If you're still having problems, you may try contacting the SQL Anywhere JDBC driver's provider for assistance.

permanent link

answered 15 Mar '23, 06:49

Mobodon's gravatar image

Mobodon
45115
accept rate: 0%

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:

×95
×86
×78
×39
×16

question asked: 01 Mar '23, 10:22

question was seen: 1,603 times

last updated: 25 Apr '23, 15:41