cancel
Showing results for 
Search instead for 
Did you mean: 

JDBC driver for Oracle Data Modeler

huber1
Participant
21,952

Hi All

I would like to connect the Oracle Data Modeler V 3.3 to the SQL Anywhere 12 database. But none of the JDBC drivers I tried worked, i. e. jconn3.jar, sajdbc4.jar, and sajdbc.jar. Is there anyone who is using this tool and was able to make a connection to SQL Anywhere 12? I am on OS X Mountain Lion (10.8), but it's not actually a platform specific problem. And yes, I know it may look like strange pairing for some, but Oracle Data Modeler is beside other qualities working on Macs, and PowerBuilder (unfortunatly) not. Sometimes I saw a reference to a jconn4.jar JDBC driver file, but I could not find it in my SQL Anywhere installation.

Thanks in advance, Robert

VolkerBarth
Contributor
0 Kudos

Don't have any clues, however, as to the jConnect driver - cf. the docs:

The jConnect driver is available as a separate download at http://www.sybase.com/products/allproductsa-z/softwaredeveloperkit/jconnect. Documentation for jConnect can also be found on the same page.

huber1
Participant
0 Kudos

Thanks Volker for the hint. I studied that as well. I have still no clear picture for what situations the JConnect driver would be useful, and is it still useful these days. It looks to me something rather old, but may be I am completely wrong. It also seems quite complicated, whereas with the jconn3.jar file I just can move it to some place and it works (except with the Oracle Data Modeler). Do you use teh jconn3.jar file? Are you aware of the jconn4.jar file? And what is it, if it really exists?

Regards, Robert

regdomaratzki
Product and Topic Expert
Product and Topic Expert
0 Kudos

Can you provide more details on "they didn't work"? What errors were returned, what connect string were you using, ...

Can other Java apps on the same machine use any of the JDBC drivers you mention to connect to a SQL Anywhere 12 database?

Former Member
0 Kudos

JConnect is the name of the driver. jconn3.jar and jconn4.jar are both JConnect.

Is the ODM giving you any error messages that we could use to track down the problem?

huber1
Participant
0 Kudos

In Oracle Data Modeler, I have to point to the JDBC driver file, i. e. make an entry as: /Library/Java/Extensions/jconn3.jar

Then, when connecting, I have to fake and select the SQL Server tab to get a dialog (screen) where I can only enter: username, password, host, and database port number.

The error I get is:

Status : Failure -Test failed: I/O Error: DB server closed connection.

which seems to say that the database is actually seen but can't be accessed correctly. What do you think?

huber1
Participant
0 Kudos

@Jonathan: I can find the jconn3.jar file in may SQL Anywhere 12 installation, but not the jconn4.jar (OS X 10.8.3). Any idea why this is missing in the installation? And what is the difference between jconn3.jar and jconn4.jar?

Accepted Solutions (1)

Accepted Solutions (1)

chris_keating
Product and Topic Expert
Product and Topic Expert

Do you source SQL Anywhere prior to starting the Oracle/Eclipse (i.e., sa_config.sh)? The SA JDBC driver has native components that it must be able to locate and use. I suspect that is the cause of your current issue.

huber1
Participant

This is the solution!

For the Oracle Data Modeler, I put the/my source command (source /Applications/SQLAnywhere17/System/bin64/sa_config.sh) in the the /Applications/OracleDataModeler.app/Contents/Resources/datamodeler/datamodeler/bin/datamodeler.conf file and it recognises the native driver with it's library and res files on startup of the Data Modeler.

For Eclipse, I made a shell script to first source and then start Eclipse. Not elegant, but it works. There sure must be some place to put the source command so I can startup Eclipse and the source command ist run before, but I couldn't find it yet. Tried with Run > External Tools > External Tools Configurations, but no success so far.

Thanks a lot! Robert

VolkerBarth
Contributor
0 Kudos

Glad you got it working finally:) - Feel free to "accept" that answer (see the check mark in front) then to make sure it is prominently marked.

Answers (4)

Answers (4)

jeff_albion
Advisor
Advisor

Yes, jConnect is still 'current' and 'supported'. It is our supported 'Type-4' ("pure Java") JDBC driver, whereas SQL Anywhere JDBC (SAJDBC) is a mixed managed and native ('Type-2') driver. You are required to source the native libraries in the java.library.path JVM value in order for the SAJDBC driver to work correctly.

--

Yes - I could connect using this tool without issue over jConnect 6.05 / SAJDBC 12.0.1.3873. Here is what I tried:

  • Java 1.7u11 JRE
  • Oracle Data Modeler 3.3
  • jConnect 6.05 (%SQLANY12%\\java\\jconn3.jar)
  • SAJDBC4 12.0.1.3873 (%SQLANY12%\\java\\sajdbc4.jar)

Reproducible Steps:

  • Start the SQL Anywhere 12 Demo Database
  • Start Oracle Data Modeler (ODM)
  • In ODM, go to Tools -> Preferences, Data Modeller -> Third Party JDBC Drivers

For jConnect:

  • [+] - Browse to 'C:\\Program Files\\SQL Anywhere 12\\java\\jconn3.jar'. [OK]
  • Restart Oracle Data Modeller
  • File -> Import -> Data Dictionary...
  • Add
    • Connection Name: SQL Anywhere 12 Demo - JCONNECT
    • Username: dba
    • Password: sql
    • [ JDBC ] Tab
    • (*) Other ThirdParty Driver
    • JDBC URL: jdbc:sybase:Tds:localhost:2638
    • Driver Class: com.sybase.jdbc3.jdbc.SybDriver
    • [Connect], ensure it is successful. Highlight the connection, click 'Next'.
  • Check 'GROUPO' for the tables to import, check off tables and views you would like to Import, click 'Next'
  • Click 'Merge' - the tables will import into your default Relational Model.

For SAJDBC4:

I need to first shut down ODM and include the SAJDBC4 native library directory in the '\\datamodeler\\bin\\datamodeler[64].conf' file. Without doing this, you will see the exception no dbjdbc found in java.library.path each time you try to connect with this driver. Here is the line I added to my configuration:

AddVMOption -Djava.library.path=c:\\Program Files\\SQL Anywhere 12\\bin64;%ORACLE_HOME%;%PATH%

Then:

  • [+] - Browse to 'C:\\Program Files\\SQL Anywhere 12\\java\\sajdbc4.jar'. [OK]
  • Restart Oracle Data Modeller
  • File -> Import -> Data Dictionary...
  • Add
    • Connection Name: SQL Anywhere 12 Demo - SAJDBC4
    • Username: dba
    • Password: sql
    • [ JDBC ] Tab
    • (*) Other ThirdParty Driver
    • JDBC URL: jdbc:sqlanywhere:DSN=SQL Anywhere 12 Demo
    • Driver Class: sybase.jdbc4.sqlanywhere.IDriver
    • [Connect], ensure it is successful. Highlight the connection, click 'Next'
  • ...

How far can you get in this connection configuration sequence, and which errors do you see when you get stuck?

huber1
Participant
0 Kudos

Great news! By "your require to source" you mean something like the installer says, i. e. source "/<path-to-sql anywhere="" 12="" folder="">/System/bin32/sa_config.sh" in my case: source "/Library/SQLAnywhere12/System/bin32/sa_config.sh" Have you got any idea if this is working with Java 6 as well? I have currently only Java 6 installed, version build 1.6.0_43, but could install Java 7. You did your tests on Windows?

Currently, the problem is, I do not get the JDBC Tab, so I can't enter the data. But I have no idea, under what circumstances the JDBC Tab will appear?

jeff_albion
Advisor
Advisor

By "your require to source" you mean something like the installer says, i. e. source "/<path-to-sql anywhere="" 12="" folder="">/System/bin32/sa_config.sh" in my case: source "/Library/SQLAnywhere12/System/bin32/sa_config.sh"

For the SAJDBC driver to use normal JDBC applications on Mac OS X, yes, you need to add the native JDBC libraries ( *.dylib - http://dcx.sybase.com/index.html#1201/en/dbprogramming/jdbc-driver-deploy.html ) to a locatable path in DYLD_LIBRARY_PATH ( http://dcx.sybase.com/index.html#1201/en/dbadmin/dyld-library-path-environment-variable.html ) - this environment variable value will be set as the default JVM value for the java.library.path. This environment variable is set as part of the sa_config.sh script.

However, I found (at least on Windows) that the Oracle Data Modeller is setting its own library path outside of the default JVM library path before it launches - I think it may have something to do with the Oracle Data Modeller attempting to source the native Oracle OCI libraries (for their JDBC driver).

Because of this reason, I described the requirement above to change the Oracle Data Modeller configuration file (datamodeler[64].conf) to add: -Djava.library.path= to the lib64 directory (or lib32 if you are running a 32-bit JVM).

Have you got any idea if this is working with Java 6 as well? I have currently only Java 6 installed, version build 1.6.0_43, but could install Java 7.

I believe this should work on Java 6 as well (as JDBC4 is also supported there). I just picked Java 7 as the JRE when Oracle Data Modeller first started up.

And what is the difference between jconn3.jar and jconn4.jar?

jconn3.jar is jConnect 6.05, and is a JDBC3 driver (Java 1.4-1.5). jconn4.jar is jConnect 7 and is a JDBC4 (1.6-1.7) driver.

Similarly for the SQL Anywhere JDBC driver (SAJDBC), we have jodbc.jar/jodbc4.jar (JDBC3 vs JDBC4), which were renamed to sajdbc.jar/sajdbc4.jar (JDBC3 vs. JDBC4) in version 12 (and later 11 EBFs).

Currently, the problem is, I do not get the JDBC Tab, so I can't enter the data. But I have no idea, under what circumstances the JDBC Tab will appear?

That question I can't really answer - I only have a Windows installation to currently test on, and the JDBC tab is definitely there in the Windows version of the Oracle Data Modeller 3.3. Maybe you can ask about this particular issue on an Oracle forum?

I see [Oracle] and [JDBC] as the two option tabs on this "Add Connection" menu. Selecting [JDBC] allows me to select (*) Other ThirdParty Driver and set the appropriate JDBC driver options. If you aren't currently making this selection, then yes, it's quite likely you aren't using the correct SQL Anywhere JDBC driver and will not be able to connect to a SQL Anywhere database.

huber1
Participant
0 Kudos

Jeff

I tried all you described but unfortunatly with no success. Problem remains I do not get this JDBC tab. Will ask in the Oracle forum. Would it be possible for you to send me your jconn3.jar and jconn4.jar files just to be sure these files are not the problem. I tried with the ones which came with the SQL Anywhere 12 installation. On Mac, there are in /Library/SQLAnywhere12/System/java/ (I installed the database at the /Library/SQLAnywhere12/ location)

jeff_albion
Advisor
Advisor
0 Kudos

Here's what it looks like for me in Windows, if it helps at all - I'm not sure what it would look like on Mac.

Would it be possible for you to send me your jconn3.jar and jconn4.jar files just to be sure these files are not the problem.

If you open a technical support case, yes, we can help verify that you have the correct jConnect files. - I have a feeling that this isn't your issue though. As mentioned, you can always get the original files here:

http://www.sybase.com/products/allproductsa-z/softwaredeveloperkit/jconnect

For this error, I really think you need to properly configure the JDBC driver from within the Oracle Data Modeller. I didn't need to do anything special once the configuration was properly added.

huber1
Participant
0 Kudos

I just miss the JDBC tab. I can get a SQL Server tab, when I install the MS SQL Server JDBC driver, but do not get the JDBC tab when putting the jconn3.jar file in the same folder.

It looks like this on OS X.

jeff_albion
Advisor
Advisor
0 Kudos

Yes, it looks like you will have to ask Oracle about this situation further - like I said, I can definitely confirm this combination works on Windows with the proper configuration.

I do have a hypothesis though: Have you installed the ODBC Administrator Tool for Mac OS X yet? I seem to recall reading somewhere that Mac OS X doesn't have an ODBC Driver Manager installed by default any more - perhaps the Oracle software is looking for an installed ODBC Driver Manager before it enables the JDBC-ODBC bridge dialog screen?

huber1
Participant
0 Kudos

With the Oracle Data Modeler Version 4.0 (Early Access) everything works, as I now get the JDBC tab which was missing in version 3.3. The Data Modeler I refer to can be found here:

http://www.oracle.com/technetwork/developer-tools/datamodeler/downloads/datamodeler-4ea-downloads-19...

Former Member
0 Kudos

Unfortunately, java.library.path only affects the Java VM itself and not the system loader. What I mean is that when Java attempts to load libdbjdbc16.dylib, it uses java.library.path to find it. However, libdbjdbc16.dylib is linked against libdbtasks16_r.dylib, and java.library.path has no effect on finding that. So libdbjdbc16.dylib is likely getting loaded, but the system loader still cannot find libdbtasks16_r.dylib.

We are working on a fix to accommodate El Capitan's enhanced security model, which will also fix this problem for you. Meanwhile, you should be able to use install_name_tool to fix the libraries you have installed. The basic idea is to tell the loader that the path to libdbtasks16_r.dylib is a relative path, and then give it a set of paths to search. Here's a start, but you may need to expand on it a bit:

$ install_name_tool -change libdbtasks16_r.dylib @rpath/libdbtasks16_r.dylib libdbjdbc16.dylib
$ install_name_tool -add_rpath @loader_path libdbjdbc16.dylib

I believe after running those two commands, in addition to the java.library.path setting, java should be able to find libdbjdbc, and the system loader should be able to find libdbtasks.

If this does not work, run dtruss as before (with -f to follow all forked processes), and look for lines that contain libdbtasks and libdbjdbc. They should tell you where the system is looking for libraries.

huber1
Participant
0 Kudos

Hi Phil

Thanks a lot for explaining some details. In the meantime, I have installed SQL Anywhere 17, and completely uninstalled version 16 (running the uninstall.sh script). Having changed your commands to libdbtask17_r.dylib and so on, I have run your commands (using absolute paths). Now when connecting, I get following error:

alt text

This is strange because there is no SQL Anywhere 16 installed on this machine. Only SQL Anywhere 17.

Former Member
0 Kudos

Did you also update the jar files that Oracle Data Modeller is loading?

huber1
Participant
0 Kudos

Hi Phil

Sorry for my delay in answering. The error was – as you suspect – in a not updated jadbc4.jar file which was still the one from SQL Anywhere 16. After updating it, the error is gone, but it's still not working. May be it's the easiest to wait for the fix for El Capitan.

Best regards and merry christmas Robert

huber1
Participant
0 Kudos

Hi Phil

I would like to ask if you have any news about the above mentioned fix for the native driver for El Capitan?

Thanks, Robert

VolkerBarth
Contributor
0 Kudos

Robert, have you tried 17.0.4 on Mac OS X (if that is already available, I don't know...) - cf. the re-freshened doc set.

huber1
Participant
0 Kudos

Volker, yes I have tried 17.0.4:2066 on OS X. And yes, it's already available 🙂 But unfortunately still the same problem. It doesn't seem to be solved. Unfortunately.

huber1
Participant
0 Kudos

Hi All

I have now SQL Anywhere 17.0.4.2129 running on OS X 10.11.6 and tested the connection with the sajdbc.jar file again. I am not able to make a connection, either from within Eclipse nor from Data Modeler. It would be very helpful to hear about the current status from SAP.

Regards, Robert

huber1
Participant
0 Kudos

Meanwhile I am on SQL Anywhere 17 (17.0.8.4003) and macOS 10.13.4. I tried to connect with

URL: jdbc:sqlanywhere:DBN=Hades;Links=tcpip(host=localhost;port=2638) Driver: sap.jdbc4.sqlanywhere.IDriver

but get the error: "no dbjdbc17 in java.library.path"

In the class path, I have added: Applications/SQLAnywhere17/System/lib64:/Applications/SQLAnywhere17/System/res

Any hint why this does not work? What could be missing?

Regards, Robert

Former Member
0 Kudos

Hi Robert, do you have sql anywhere 17 sa_config.sh sourced? and if so, please check that your path actually includes everything listed in sa_config.sh file. Alternatively, try also adding Applications/SQLAnywhere17/System/bin64 to your class path.

huber1
Participant
0 Kudos

Hi Eugeniya, do you mean bei sourcing sa_config.sh executing the command: source /Applications/SQLAnywhere17/System/bin64/sa_config.sh in a terminal, after installation of SQL Anywhere 17? Yes, I did that.

I also added /Applications/SQLAnywhere17/System/bin64 but getting the same error message. BTW, I also use Eclipse and try to establish the same connection (as in ODM), but it doesn't work.

It does work, however (with Eclipse and Oracle Data Modeler (ODM)), with both jconn3.jar and jconn4.jar drivers and using URL: jdbc:sybase:Tds:localhost:2638?ServiceName=Hades&CHARSET=utf8 Driver: com.sybase.jdbc4.jdbc.SybDriver

But I would like to connect natively as I also expect speed gains.

Former Member
0 Kudos

Hi Robert, Please try to open new terminal window, run source /Applications/SQLAnywhere17/System/bin64/sa_config.sh there and then open Eclipse as executable from that terminal. Let me know if it works, Evgeniya

huber1
Participant
0 Kudos

Hi Evgeniya Thanks for your suggestion. I run source /Applications/SQLAnywhere17/System/bin64/sa_config.sh in the terminal and started (opened) from within the terminal Eclipse. I could make a successful connection to the database :-) Unfortunately, as soon as I wanted to save this database server connection (in Eclipse), I get the "no dbjdbc17 in java.library.path" error (again). So I think we are one step closer but why can it be that I can't save the connection but without saving the connection it's possible to establish a successful connection? Regard, Robert

Former Member
0 Kudos

Robert, I was able to save a connection when I added all files listed here: https://help.sap.com/viewer/410823be16f44a3aac29673e90dd8c46/17.0/en-US/815de54e6ce21014b42afce8c8d9... to the driver files. I am not sure if I did the same thing you are trying to do, but hopefully it will give you an idea. If you still won't be able to figure it out and have a support contract, you will probably need to open a ticket. Evgeniya

huber1
Participant
0 Kudos

Hi Evgeniya

I once again tried all the suggestions in this thread, unfortunately without success.

By reading the thread in detail, I also came again across the answer from Phil Mitchell, where he is saying: "We are working on a fix to accommodate El Capitan's enhanced security model, which will also fix this problem for you."

Are you aware about the state of this fix? In what version of the database is it included?

Thanks for your help. Robert

chris_keating
Product and Topic Expert
Product and Topic Expert
0 Kudos

That behaviour was addressed prior to SA17 release. It was fixed in v12 (12.0.1.4359 or newer) and v16 (16.0.0.2222 or newer).

Here is the fix notes: SQL Anywhere software on UNIX platforms requires LD_LIBRARY_PATH (or the equivalent for the platform) to be set in order for the loader to find dependent libraries. This makes the use of the software inconvenient, especially when interfacing with third-party applications.

Additionally, SQL Anywhere software may fail to find dependent libraries on Mac OS X 10.11, even if DYLD_LIBRARY_PATH is set properly. The new security policy in this version of Mac OS X causes DYLD_LIBRARY_PATH to be unset in certain cases, causing the loader to fail to find libraries.

This has been fixed to some degree on all UNIX platforms except AIX. However, some use cases will still need this or some other environment variable to be set. In some cases, user applications will need some adjustment.

Specifically: - When using a client API that requires libdbcapi, either LD_LIBRARY_PATH or SQLANY_API_DLL must be set correctly. - When using Java with native libraries, such as JDBC (including when using Java external environment; except on Mac), either LD_LIBRARY_PATH must be set or the -Djava.library.path=/path/to/sqlanywhere/lib64 command line switch must be used. - When using external functions, either LD_LIBRARY_PATH must be set or the full path to the shared library must be provided. - If you use a custom install layout, you may find that LD_LIBRARY_PATH is still needed. On Mac OS X, it is possible to use install_name_tool to provide additional search paths instead of using DYLD_LIBRARY_PATH.

Former Member
0 Kudos

Hi Robert,

I believe it was fixed in build 17.0.0.1356. Can you please give me steps on how you are saving the database connection?

Regards, Evgeniya

huber1
Participant
0 Kudos

Sorry for my very late repsonse, Chris. I tried (in many different variations) what you describe but just can't get this connection to work on macOS. Not with Oracle Data Modeler, nor with Eclipse using Servoy.

Mostly, I get the error: invalid ODBC handle. Although I am configuring a JDBC connection. Sometimes, on ODM, the connection trial just stucks forever.

I am out of ideas how to get this to work.

Regards, Robert

huber1
Participant
0 Kudos

May be I should mention that I use SQL Anywhere 17 Version 17.0.8.4003 and following connection data:

JDBC URL: jdbc:sqlanywhere:DBN=Hades (tried all sorts of data here as mentioned in the thread) Driver Class: sap.jdbc4.sqlanywhere.IDriver

It works without any problem when using the jconn4.jar driver and:

JDBC URL: jdbc:sybase:Tds:localhost:2638?ServiceName=Hades&CHARSET=utf8 Driver Class: com.sybase.jdbc4.jdbc.SybDriver

huber1
Participant
0 Kudos

Pleas also excuse me for the long delay to answer. I use a server connection of the tool (ODM or Eclipse) and the connection data for JDBC URL and Driver Class are the ones like shown in the answer to Chris.

huber1
Participant
0 Kudos

Chris

You made a comment about source(ing) the sa_config.sh file. For some reasons it seems to be disappeared. But that works now as you suggested.

For the Oracle Data Modeler, I have inserted the:

source /Applications/SQLAnywhere17/System/bin64/sa_config.sh
command in the /Applications/OracleDataModeler.app/Contents/Resources/datamodeler/datamodeler/bin/datamodeler.conf file.

For Servoy, i. e. Eclipse, I start it in a shell script like

source /Applications/SQLAnywhere17/System/bin64/sa_config.sh
open -a /Applications/Servoy8.1/servoy.app

I assume there is a more elegant way to put the source command within Eclipse, but did not find it yet. Any suggestions are welcome.

Thanks to all who responded to make this work. Now I can start to compare possible speed differences in our applications. Robert

VolkerBarth
Contributor
0 Kudos

@Robert, I have turned Chris's comment into an answer after you told that it solved the problem. See the second answer here, when sorted by "popular answers". IMHO this made sense because this FAQ is really hard to follow with several answers and many nested comments. Feel free to add your current comment there.

huber1
Participant
0 Kudos

Volker, you are absolutes right saying this thread is hard to read. It started quit some time ago whereas the database now is in a much newer version. Luckely it works now on Mac with just sourcing the sa-config.sh file. So all is fine for Mac users, including me, I assume. Your turning of Chris comment is ok for me. Thanks and regards, Robert

huber1
Participant
0 Kudos

Hi Jeff

I got the reference where to find your mentioned datamodeler.conf file in OS X and added this line as you described (for sajdbc4.jar):

AddVMOption -Djava.library.path=/Applications/SQLAnywhere16/System/lib64;%ORACLE_HOME%;%PATH%

Now, in Oracle Data Modeler, I get the exact same error as with my Application Server, namely

alt text

Best regards, Robert

huber1
Participant
0 Kudos

Hi Jeff

Coming back to this thread, I download the ASE trial from SAP Marketplace and found there in the folder jConnect-16_0 > classes the jconn4.jar file I was looking for as mentioned elsewhere on this forum. I could get ODM to work with this jconn4.jar driver. Bur, I would very much like to get it to work with the SQL Anywhere 16 native sajdbc4.jar driver. I put the sajdbc4.jar file at the same place as the jconn4.jar file, i. e. at /Library/Java/Extensions/ but get the attached error message 1. If I put all the files mentioned here: http://dcx.sybase.com/index.html#sa160/en/dbprogramming/jdbc-client-deploy.html in the same place as the sajdbc4.jar file, I get the error as seen in error message 2.

Best regards, Robert

PS: By the way, do you know if running the database with jconn4.jar is faster than with conn3.jar?

alt text

alt text

jeff_albion
Advisor
Advisor
0 Kudos

Hi Robert,

Did you edit the '\\datamodeler\\bin\\datamodeler[64].conf' file to include the library path for the libdbjdbc16.dylib and all of the associated files? It looks like some of the required SAJDBC files (lidbtasks16_r.dylib specifically) can't be found.

By the way, do you know if running the database with jconn4.jar is faster than with conn3.jar?

jconn3.jar vs. jconn4.jar is really a matter of which version of JDBC you're using (JDBC 3.0 vs. JDBC 4.0) and which version of jConnect you're using (jConnect 6.x vs. jConnect 7.x). Underneath the covers, the code is still largely the same between the two so I would doubt there would be any significant speed advantage between the two.

SAJDBC (sajdbc4.jar) vs jConnect though (jconn4.jar), SAJDBC is typically faster because of the native layer, which is the advantage to deploying the native files and altering the system path of the application to use them instead.

huber1
Participant
0 Kudos

Hi Jeff

I am on OS X 10.10.5. There is no '\\datamodeler\\bin\\datamodeler[64].conf' file. May be some plist file. Problem is, I have an Application Server (Servoy/TomCat), an IDE Eclipse with Servoy plugin, and Oracle Data Modeler. Because I don't know the steps where to put the (driver) files and I also seem not be able to find them somewhere, I can't get my environment to work. On the other hand, it should not be so difficult, should it.

Any idea?

Best regards Robert

jeff_albion
Advisor
Advisor
0 Kudos

Hmmm... the SAJDBC driver worked fine with the Data Modeler on Windows for myself, as I described above. All I needed to do was alter the system path for the Oracle Data Modeler environment.

This document from Oracle:

http://www.oracle.com/technetwork/developer-tools/datamodeler/downloads/data-modeler-relnotes-v402-2...

suggests that the datamodeler.conf file should be common across Windows, Linux and Mac OS X. So, perhaps you can review the files you downloaded and see if the file is listed...?

huber1
Participant
0 Kudos

Hi Jeff

Leaving the ODM discussion, how can I connect to the SQL Anywhere 16 database with the sajdbc4.jar driver (generally spoken). I just can't seem to find a step by step instruction on how to connect to the database. Putting the sajdbc4.jar file to the same place (in the file system) as jconn4.jar is not sufficient. The question is which files to put where (on OS X)? Any hint?

Thanks in advance Robert

jeff_albion
Advisor
Advisor
0 Kudos

So there are two pieces to the "Type-2 (Mixed Mode)" SAJDBC driver (i.e. sajdbc4.jar managed driver plus the *.dylib native files), versus just one piece for the "Type-4 (Pure Java)" jConnect driver (i.e. just the managed jconn4.jar file).

When Java loads a .JAR file, it always loads it from the CLASSPATH. This is an environment variable set in the Java application environment or as part of a -cp argument to the Java executable. So for both .JAR files, you need to ensure they would appear in the CLASSPATH for the Java application. This is why both .JAR files can appear side-by-side and can get loaded similarly.


For the SAJDBC ("Type 2") driver however, there are also native compiled files that also need to be deployed and referenced by the Java process. It sounds like this is the piece you're having issues with...

On Windows, the native files are .DLL, on Linux .SO, and on Mac OS X, .DYLIB files and are listed in the documentation here.

Similar to JAR files, Java loads the native library location information from the application environment. However, instead of the CLASSPATH environment variable, Java uses the native library paths of the environment to determine the location of the native files - this value is then provided as the java.library.path value to Java.

How the java.library.path value is determined separately on each OS:

On all of the Linux, Mac OS X, and UNIX distributions, there is a /bin32/sa_config.(c)sh file with SQL Anywhere that automatically will set these values for the environment. So to source the native files correctly for the Java process, you need to either:

  1. Alter the environment variable from where Java launches from (which will pick up the environment variables) - i.e. source the script, then run Java:

    . $SQLANY16/bin64/sa_config.sh

    java ...

  2. Alter the Java launcher command line: java -Djava.library.path=/native/path/to/add ...


Because of the potential difficulty to source the environment for the Oracle Data Modeller, this is why I recommended the alteration of the datamodeler.conf file above to add:

AddVMOption -Djava.library.path=/native/path/to/add/...

as this would modify the native path to include the .DYLIB required files (or .DLL on Windows, as I had showed earlier).

When sourcing the native libraries, be sure to match native bitness of the libraries to the bitness of the Java process (i.e. 32-bit to .../lib32 or 64-bit to .../lib64).

huber1
Participant
0 Kudos

Hi Jeff

Thanks a lot for your detailed information. It is very appreciated. I did apply your suggestions to the start of my application server (Servoy Server based on TomCat).

The startup shell script looks like follows. I added the part: -Djava.library.path=/Applications/SQLAnywhere16/System/lib64 as you mention.

#!/bin/sh

if [ -z "$CMD_LINE_START" ]; then
    CMD_LINE_START="java"
fi

while true
do
    $CMD_LINE_START -Djava.awt.headless=true -Djava.library.path=/Applications/SQLAnywhere16/System/lib64 -Xmx1280m -Xms256m -classpath .:lib/activation.jar:lib/antlr.jar:lib/apache-mime4j.jar:lib/BrowserLauncher2.jar:lib/commons-codec.jar:lib/commons-collections.jar:lib/commons-dbcp.jar:lib/commons-fileupload.jar:lib/commons-io.jar:lib/commons-logging.jar:lib/commons-pool.jar:lib/dom4j.jar:lib/hibernate3.jar:lib/httpclient.jar:lib/httpclient-cache.jar:lib/httpcore.jar:lib/httpmime.jar:lib/j2db.jar:lib/j2dbdev.jar:lib/jabsorb.jar:lib/xstream.jar:lib/javassist.jar:lib/jcifs.jar:lib/joda-time.jar:lib/js.jar:lib/jta.jar:lib/jug.jar:lib/log4j.jar:lib/mail.jar:lib/MRJAdapter.jar:lib/networktnl.jar:lib/rmitnl.jar:lib/server-bootstrap.jar:lib/servlet-api.jar:lib/slf4j-api.jar:lib/slf4j-log4j.jar:lib/wicket.jar:lib/wicket-calendar.jar:lib/wicket-extentions.jar:lib/wiquery.jar:lib/fs-parser.jar:lib/fs-commons.jar:lib/minis.jar:lib/PBKDF2.jar:lib/prompt.jar com.servoy.j2db.server.main.ApplicationServer "$@" 1>> server.log 2>> server.log
    EXITCODE=$?
    if [ "$EXITCODE" != 99 ] && [ "x$EXITCODE" != "x$ADDITIONAL_RESTART_CODE" ]; then exit $EXITCODE; fi
done

I get the following error:

Exception in thread "pool-1-thread-1" java.lang.UnsatisfiedLinkError: /Applications/SQLAnywhere16/System/lib64/libdbjdbc16.dylib: dlopen(/Applications/SQLAnywhere16/System/lib64/libdbjdbc16.dylib, 1): Library not loaded: libdbtasks16_r.dylib
  Referenced from: /Applications/SQLAnywhere16/System/lib64/libdbjdbc16.dylib
  Reason: image not found
    at java.lang.ClassLoader$NativeLibrary.load(Native Method)
    at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1938)
    at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1854)
    at java.lang.Runtime.loadLibrary0(Runtime.java:870)
    at java.lang.System.loadLibrary(System.java:1122)
    at sybase.jdbc4.sqlanywhere.IDriver.try_load(IDriver.java:487)
    at sybase.jdbc4.sqlanywhere.IDriver.<clinit>(IDriver.java:425)
    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:422)
    at java.lang.Class.newInstance(Class.java:442)
    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 com.sybase.jdbc4.jdbc.SybDriver.registerWithDriverManager(SybDriver.java:708)
    at com.sybase.jdbc4.jdbc.SybDriver.<init>(SybDriver.java:139)
    at com.sybase.jdbc4.jdbc.SybDriver.<clinit>(SybDriver.java:103)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)

...

The mentioned files are all in the folder /Applications/SQLAnywhere16/System/lib64/

jeff_albion
Advisor
Advisor
0 Kudos

Hi Robert,

Is this a full install of SQL Anywhere or just a client deployment? If a deployment, how was the client deployed? Can you try opening a Terminal and running the following commands:

Confirm that these are 64-bit binaries deployed:

file /Applications/SQLAnywhere16/System/lib64/libdbjdbc16.dylib
file /Applications/SQLAnywhere16/System/lib64/libdbtasks16_r.dylib

Confirm library linkages for each library:

otool -L /Applications/SQLAnywhere16/System/lib64/libdbjdbc16.dylib
otool -L /Applications/SQLAnywhere16/System/lib64/libdbtasks16_r.dylib

Are there any missing libraries mentioned?

Can you confirm that this is a 64-bit java process and not 32-bit?

file `which java`
huber1
Participant
0 Kudos

Hi Jeff

This is a full install of SQL Anywhere 16 (Developer Edition). There are no mentioned libraries missing. The 5 mentioned libraries and the language file are in place, at /lib64 and /res. And yes, it is a 64-bit java process.

Following the results of your commands in the terminal:

Roberts-MacBook-Pro:~ robert$ file /Applications/SQLAnywhere16/System/lib64/libdbjdbc16.dylib /Applications/SQLAnywhere16/System/lib64/libdbjdbc16.dylib: Mach-O 64-bit dynamically linked shared library x86_64 Roberts-MacBook-Pro:~ robert$ file /Applications/SQLAnywhere16/System/lib64/libdbtasks16_r.dylib /Applications/SQLAnywhere16/System/lib64/libdbtasks16_r.dylib: Mach-O 64-bit dynamically linked shared library x86_64 Roberts-MacBook-Pro:~ robert$ otool -L /Applications/SQLAnywhere16/System/lib64/libdbjdbc16.dylib /Applications/SQLAnywhere16/System/lib64/libdbjdbc16.dylib: libdbjdbc16.dylib (compatibility version 0.0.0, current version 0.0.0) libdbtasks16_r.dylib (compatibility version 0.0.0, current version 0.0.0) /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1197.1.1) /usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version 60.0.0) Roberts-MacBook-Pro:~ robert$ otool -L /Applications/SQLAnywhere16/System/lib64/libdbtasks16_r.dylib /Applications/SQLAnywhere16/System/lib64/libdbtasks16_r.dylib: libdbtasks16_r.dylib (compatibility version 0.0.0, current version 0.0.0) /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1197.1.1) /usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version 60.0.0) Roberts-MacBook-Pro:~ robert$ file which java /usr/bin/java: Mach-O universal binary with 2 architectures /usr/bin/java (for architecture i386): Mach-O executable i386 /usr/bin/java (for architecture x86_64): Mach-O 64-bit executable x86_64 Roberts-MacBook-Pro:~ robert$

jeff_albion
Advisor
Advisor
0 Kudos

Hmmm, that's very strange - can you also run dbversion against these files?

dbversion /Applications/SQLAnywhere16/System/lib64/libdbjdbc16.dylib
dbversion /Applications/SQLAnywhere16/System/lib64/libdbtasks16_r.dylib

We are wondering if perhaps /lib32 was getting loaded first via DYLD_LIBRARY_PATH - do you have that environment variable set on the system at all? (Although that shouldn't matter when you hard-code -Djava.library.path...)

Can you maybe run dtruss on the Java process to confirm where the dlopen() is getting its resources from?

huber1
Participant
0 Kudos

Jeff, following the result for dbversion:

Roberts-MacBook-Pro:~ robert$ /Applications/SQLAnywhere16/System/bin64/dbversion /Applications/SQLAnywhere16/System/lib64/libdbjdbc16.dylib
SQL Anywhere Version Diagnostic Utility Version 16.0.0.2087
/Applications/SQLAnywhere16/System/lib64/libdbjdbc16.dylib: libdbjdbc16.dylib GA 16 0 0 2087 macosx 2015/02/20 00:50:54 posix 64 production
Roberts-MacBook-Pro:~ robert$ /Applications/SQLAnywhere16/System/bin64/dbversion /Applications/SQLAnywhere16/System/lib64/libdbtasks16_r.dylib
SQL Anywhere Version Diagnostic Utility Version 16.0.0.2087
/Applications/SQLAnywhere16/System/lib64/libdbtasks16_r.dylib: libdbtasks16_r.dylib GA 16 0 0 2087 macosx 2015/02/20 00:39:22 posix 64 production
Roberts-MacBook-Pro:~ robert$

I do not have set the environment variable DYLD_LIBRARY_PATH

Are you looking (with dtruss) for something like this?…

stat64("/Applications/Servoy/application_server/server/webapps/ROOT\\0", 0x1248D6FA0, 0x0)         = 0 0
stat64("/Applications/Servoy/application_server/server/webapps/ROOT\\0", 0x1248D6FA0, 0x0)        = 0 0
stat64("/Applications/Servoy/application_server/server/conf/context.xml\\0", 0x1248D6FA0, 0x0)        = 0 0
stat64("/Applications/Servoy/application_server/server/conf/context.xml\\0", 0x1248D7000, 0x0)        = 0 0
stat64("/Applications/Servoy/application_server/server/conf/web.xml\\0", 0x1248D6FA0, 0x0)        = 0 0
stat64("/Applications/Servoy/application_server/server/conf/web.xml\\0", 0x1248D7000, 0x0)        = 0 0
stat64("/Applications/Servoy/application_server/server/webapps/eastwood.war\\0", 0x1248D6FA0, 0x0)        = 0 0
stat64("/Applications/Servoy/application_server/server/webapps/eastwood.war\\0", 0x1248D6FA0, 0x0)        = 0 0
stat64("/Applications/Servoy/application_server/server/webapps/eastwood.war\\0", 0x1248D7000, 0x0)        = 0 0
stat64("/Applications/Servoy/application_server/server/webapps/eastwood\\0", 0x1248D6FA0, 0x0)        = 0 0
stat64("/Applications/Servoy/application_server/server/webapps/eastwood\\0", 0x1248D6FA0, 0x0)        = 0 0
stat64("/Applications/Servoy/application_server/server/conf/context.xml\\0", 0x1248D6FA0, 0x0)        = 0 0
stat64("/Applications/Servoy/application_server/server/conf/context.xml\\0", 0x1248D7000, 0x0)        = 0 0
stat64("/Applications/Servoy/application_server/server/conf/web.xml\\0", 0x1248D6FA0, 0x0)        = 0 0
stat64("/Applications/Servoy/application_server/server/conf/web.xml\\0", 0x1248D7000, 0x0)        = 0 0
open_nocancel("/Applications/Servoy/application_server/server/webapps\\0", 0x1100004, 0x4)        = 214 0
fstatfs64(0xD6, 0x1248D6BD8, 0x4)        = 0 0
getdirentries64(0xD6, 0x7FF9ADE2C800, 0x1000)        = 200 0
getdirentries64(0xD6, 0x7FF9ADE2C800, 0x1000)        = 0 0
close_nocancel(0xD6)         = 0 0

With many thanks, Robert

huber1
Participant
0 Kudos

Jeff

Did my results for dbversion help you to come a step further?

Robert

jeff_albion
Advisor
Advisor
0 Kudos

Hi Robert,

Thanks for checking back and staying with this - unfortunately, no, your answers only puzzled me further. I was hoping for something more obvious.

I think the next step is for us to look at the 16.0.0.2087 developer edition on a Mac and see what happens when we try it. Other than a possible 32-to-64 bitness incompatibility between the libraries and Java, we don't really have an explanation for why the native libraries aren't working based on your answers.

huber1
Participant
0 Kudos

Hi Jeff

Thank you. I try to support you as much as possible as I really would like to get the native JDBC Adaptor running. I also will install on a local OS X Machine the latest EBF and report back.

Thank you for your continued support on this.

Robert

huber1
Participant
0 Kudos

Hi Jeff

I applied the latest EBF, the SQL Anywhere 16 version is now 16.0.0.2087. Unfortunately, it still does not work. Have you found anything. Could you replicate it on your testing environment?

Thanks a lot for your feedback. Robert