The forum will experience an outage sometime between February 10 at 7:00pm EST and February 12 at 11:59 EST for installation of security updates. The actual time and duration of the outage are unknown but attempts will be made to minimize the downtime. We apologize for any inconvenience.

Hi All

I connect with our IDE (Servoy, an Eclipse plug-in) to SQL Anywhere 12.0.1 using the jconn3.jar driver. Among the JDBC parameters, the URL and Driver are set to: URL: jdbc:sybase:Tds:localhost:2638?ServiceName=dbName&CHARSET=utf8 Driver: com.sybase.jdbc3.jdbc.SybDriver

This works fine (for years already :-)

Now i would like to use the sajdbc4.jar driver and set the 2 above mentioned parameters to: URL: jdbc:sqlanywhere:localhost:2638?ServiceName=dbName&CHARSET=utf8 Driver: sybase.jdbc4.sqlanywhere.IDriver

but get the error message (when I try to save the newly defined Database Server, i. e. JDBC Adaptor): Save Failed no dbjdbc12 in Java.library.path

I am on OS X 10.7.5 and Java 1.6.0_35

It's true that there is no dbjdbc12.jar in the library path, because in OS X it's called libdbjdbc12.dylib as described here: http://dcx.sybase.com/index.html#1201/en/dbprogramming/jdbc-driver-deploy.html But may be the error message is not adjusted for OS X, could that be?

Has anyone an idea what the missing piece could be to connect with this (sajdbc4.jar) driver?

PS: According to the info here: http://iablog.sybase.com/hinsperg/2009/10/connecting-to-sql-anywhere-using-jdbc/ it seems to me that there is no need to specify the Driver any more, i. e. leaving the field empty?

Thanks for any help and hints, Robert

asked 04 Oct '12, 04:11

robert's gravatar image

robert
543253345
accept rate: 0%


For the SAJDBC driver on Mac OS X, we search the "DYLD_LIBRARY_PATH" environment variable to locate system libraries.

Does "libdbjdbc12.dylib" exist in a path specified by this environment variable, for this Java executable seesion? (Java's "java.library.path" will include these paths by default upon JVM launch).

Alternatively, can you source sa_config.sh prior to launching the Java session?

(And yes, with JDBC 4.0, you no longer have to use the DriverManager.registerDriver() call to register the JAR file - this now happens automatically)

permanent link

answered 04 Oct '12, 13:11

Jeff%20Albion's gravatar image

Jeff Albion
10.7k171174
accept rate: 24%

edited 04 Oct '12, 13:14

Thank you. I just can't seem to get it to work with the sajdbc4.jar file. I have put the file in the same place as the jconn3.jar file, but no luck. I tested with removing the jconn3.jar and looking if connection is not possible (it's not), putting it back in place and connection is possible again. Unfortunatly that does not work with the sajdbc4.jar file.

I used for URL: jdbc:sqlanywhere:localhost:2638?ServiceName=dbName&CHARSET=utf8 Driver: field leaving empty DYLD_LIBRARY_PATH=/Library/SQLAnywhere12/System/lib32/ -> same as for jconn3.jar

I also tried setting the DYLD_LIBRARY_PATH to .../lib64 -> no luck either.

It seems I am missing one more piece to get it to run. Any hint?

Regards, Robert

(05 Oct '12, 13:03) robert
Replies hidden

By the way, I also tried with Driver field set to: sybase.jdbc4.sqlanywhere.IDriver

(05 Oct '12, 13:04) robert

I used for URL: jdbc:sqlanywhere:localhost:2638?ServiceName=dbName&CHARSET=utf8

That's unfortunately a jConnect URL, not a SQL Anywhere JDBC URL. A SQL Anywhere JDBC URL should look like the examples in the documentation and normally contain the regular SQL Anywhere database connection parameters.

e.g.

 jdbc:sqlanywhere:UID=dba;PWD=sql;SERVER=MyServer;DBN=dbName;LINKS=shmem,tcpip(host=localhost;port=2638)

Are you getting the same "No dbjdbc12 in path" error when you try this?

I also tried setting the DYLD_LIBRARY_PATH to .../lib64 -> no luck either

Is Eclipse running/launching a 32-bit or 64-bit JVM? Are you sure that you're setting this value for your Eclipse launch environment correctly?

(05 Oct '12, 13:27) Jeff Albion

Hi Jeff, unfortunatly yes, I still get no dbjdbc12 in path, or sometimes, I get JDBC Driver '' not found in class path or drivers directory : java.lang.ClassNotFoundException: (depending whether the Driver field is filled or not), but assume this message is saying the same. I have the sajdbc4.jar at the same place as the jconn3.jar file, which is recognized. I am running a JVM 64 bit, and as far as I understand the OS X version of SQL Anywhere is a 32 bit version, but I also tried pointing to the 64 bit library and that didn't help. Somehow my picture about what should be in what place is blurry, so I am not sure what dedicated action to take to get one step further.

(08 Oct '12, 05:52) robert

I should say that even having URL and Driver field empty gives me the error JDBC Driver '' not found ... so it seems it doesn't recognize the file, although it's in the same place as the jconn3.jar file.

(08 Oct '12, 05:53) robert
Replies hidden

The sajdbc4.jar file should be in the Java environment's classpath (e.g. java -cp /path/to/sajdbc4.jar:/.. ). The libdbjdbc12.dylib should be in the DYLD_LIBRARY_PATH path, which should match the bitness of the JVM you are running (64-bit in this case). This path value should be passed into the JVM's "java.libaray.path" variable. If you echo this variable ( System.getProperty("java.library.path"); ) in your Java program, does it return the same value as DYLD_LIBRARY_PATH (to ../lib64), or is it being overridden by your IDE to another value perhaps...?

(08 Oct '12, 15:21) Jeff Albion

Jeff

The Java Library Path of my IDE (Servoy Developer) when I read System.getProperty("java.library.path") is: .:/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java

The Startup of of my IDE (Servoy Developer) incl. the DYLD_LIBRARY_PATH is: /Library/SQLAnywhere12/System/bin32/dbspawn|/Library/SQLAnywhere12/System/bin32/dbsrv12|@/Library/SQLAnywhere12/SQLAnywhere.config#LC_CTYPE=C|LANG=C|DYLD_LIBRARY_PATH=/Library/SQLAnywhere12/System/lib32/

My SQLAnywhere12.config file looks like:

!/bin/sh

SQL Anywhere 12 dbsrv12 configuration file (SQLAnywhere.conf)

Author: Robert Huber

Date: 15.07.2012

Description: There are 2 parts in this script

- Options for database server at startup

- Databases to be automatically startup at system start

DATABASE SERVER OPTIONS

Server name (-n option is positional, appearing before a db file it names the server, after a db file it names the db)

-n walker

Server side network communication protocolls

-x tcpip{dobroadcast=no;port=2638}

Permission required to start and stop a database

-gd dba

Client idle time, disconnect inactive connections after specidied time in minutes (0 = never disconnect)

-ti 0

Set inital cache (1024m = 1024MB)

-c 1024m

Enforce static cache size (0 = disable automatic cache size tuning)

-ca 0

Suppress database server messages window (all OS)

-qw

Log database server messages to log file

-o /Library/SQLAnywhere12/sybase_log.txt

DATABASES TO STARTUP AT SYSTEM START

/Library/SQLAnywhere12/databases/servoy_repository.db /Library/SQLAnywhere12/databases/Hades.db

This setup works with the jconn3.jar driver but not with the sajdbc4.jar driver. The jconn3.jar file is in a sub folder of the Servoy installation, as is the sajdbc4.jar file.

I also tried with 2 other tools (WOLips Entity Modeler and Cayenne Modeler) which connect via JDBC to SQL Anywhere, but get the same error. And these tools use the Java Library Path: /System/Library/Java/Extensions

You are saying that I should point to the 64 bit path, but SQLAnywhere 12 on OS X only exists as a 32 bit version.

I did startup with the 32 bit Java, but that didn't help either.

(10 Oct '12, 10:13) robert
showing 4 of 7 show all flat view

FWIW, AFAIK the SAJDBC driver does not use jConnect's particular syntax to specify connection information but does use the usual SQL Anywhere connection parameters, as documented here.

So I guess once your driver loading problem is solved, you will have to adapt the connection string accordingly to be able to connect.

permanent link

answered 05 Oct '12, 04:05

Volker%20Barth's gravatar image

Volker Barth
29.3k287438644
accept rate: 32%

Thanks, I used the syntax as mentioned above

(05 Oct '12, 13:19) robert
Comment Text Removed
Comment Text Removed
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:

×64

question asked: 04 Oct '12, 04:11

question was seen: 8,566 times

last updated: 10 Oct '12, 10:13