|
Home > Archive > SQL Anywhere for Linux > July 2005 > jODBC driver on linux
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
jODBC driver on linux
|
|
| Andre Schild 2005-07-11, 7:23 am |
| Hello,
until now we used the jConnect driver under win32 and linux.
We wish now to test the jODBC driver, and under win32 it works.
But we are not able to get it working under linux.
Our environment:
SuSE 9.1
ASA 9.0.2.2552
Sun JAVA JDK 1.5.0_03
Our problem(s)
1. We are not able to find any file named dbodbc9.so.
According to the docus this file is needed.
When we start up the application, we get this error:
java.lang. UnsatisfiedLinkError
: no dbjodbc9 in java.library.path
at java.lang.ClassLoader. loadLibrary(ClassLoa
der.java:1682)
at java.lang.Runtime. loadLibrary0(Runtime
.java:822)
at java.lang.System.loadLibrary(System.java:992)
at ianywhere.ml.jdbcodbc.IDriver.try_load(IDriver.java:247)
at ianywhere.ml.jdbcodbc.IDriver.<clinit>(IDriver.java:216)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:164)
2. Since the documentation is wrong on the filename, we did add
"source /opt/sybase/SYBSsa9/bin/asa_config.sh" to the
start script.
Assuming that the correct filenames are libdbodbc9.so
When we start the application, we then get a segmentation fault
"5005 Segmentation fault java -cp jodbc.jar:TomcatMonitor.jar
com.aarboard.monitor.tomcat.Main"
Is this a JDK 1.5 problem or what I'm missing ?
I need the 1.5 version, since it's using JMX...
André
| |
| Greg Fenton 2005-07-11, 11:23 am |
| Andre Schild wrote:
>
> 1. We are not able to find any file named dbodbc9.so.
> According to the docus this file is needed.
> When we start up the application, we get this error:
>
> java.lang. UnsatisfiedLinkError
: no dbjodbc9 in java.library.path
Since this is a Linux platform, I believe Java is looking for
"libdbjodbc9.so", which should be in $ASANY9/lib.
>
> When we start the application, we then get a segmentation fault
> "5005 Segmentation fault java -cp jodbc.jar:TomcatMonitor.jar
> com.aarboard.monitor.tomcat.Main"
>
I'd need to know a lot more about your application to understand why
Java would be segfaulting. But rather than doing that, I would suggest
taking a simple application and try connecting using the iAnywhere JDBC
driver first.
I just posted the following sample to the general newsgroup. Give it a
try (though you'll have to change the value of DB_DIR):
//--------- Start of TestIasJdbc.java ----------------------------
import java.sql.*;
public class TestIasJdbc {
public static String DB_DIR = "c:/program files/sqlanywhere 9";
public static void main(String args[]) {
try {
String driver, url;
Connection conn;
driver="ianywhere.ml.jdbcodbc.IDriver";
url = " jdbc:odbc:driver=Ada
ptive Server Anywhere 9.0"
+ " ;uid=DBA;pwd=SQL;dbf
=" + DB_DIR
+ "/asademo.db";
Class.forName( driver );
conn = DriverManager.getConnection( url );
if ( conn != null ) {
System.out.println("connected");
System.exit(0);
} else {
System.out.println("connection failed!");
System.exit(10);
}
} catch (Exception ex) {
System.out.println( ex.getMessage() );
}
}
}
//--------- End of TestIasJdbc.java -------------------------------
The command to compile the code in a win32 shell is:
javac -classpath "$ASANY9/java/jodbc.jar" TestIasJdbc.java
The command to run the class is:
java -classpath ".:$ASANY9/java/jodbc.jar" TestIasJdbc
> Is this a JDK 1.5 problem or what I'm missing ?
> I need the 1.5 version, since it's using JMX...
>
I have not played with JDK 1.5 on Linux yet, but if the above sample
does not work please post back with details on the failure.
Hope this helps,
greg.fenton
--
Greg Fenton
Consultant, Solution Services, iAnywhere Solutions
--------
Visit the iAnywhere Solutions Developer Community
Whitepapers, TechDocs, Downloads
http://www.ianywhere.com/developer/
| |
| Andre Schild 2005-07-12, 3:23 am |
| Greg Fenton schrieb:
> Andre Schild wrote:
>
>
>
> Since this is a Linux platform, I believe Java is looking for
> "libdbjodbc9.so", which should be in $ASANY9/lib.
>
>
>
> I'd need to know a lot more about your application to understand why
> Java would be segfaulting. But rather than doing that, I would suggest
> taking a simple application and try connecting using the iAnywhere JDBC
> driver first.
>
> I just posted the following sample to the general newsgroup. Give it a
> try (though you'll have to change the value of DB_DIR):
>
> //--------- Start of TestIasJdbc.java ----------------------------
> import java.sql.*;
>
> public class TestIasJdbc {
>
> public static String DB_DIR = "c:/program files/sqlanywhere 9";
>
> public static void main(String args[]) {
> try {
> String driver, url;
> Connection conn;
> driver="ianywhere.ml.jdbcodbc.IDriver";
> url = " jdbc:odbc:driver=Ada
ptive Server Anywhere 9.0"
> + " ;uid=DBA;pwd=SQL;dbf
=" + DB_DIR
> + "/asademo.db";
> Class.forName( driver );
> conn = DriverManager.getConnection( url );
> if ( conn != null ) {
> System.out.println("connected");
> System.exit(0);
> } else {
> System.out.println("connection failed!");
> System.exit(10);
> }
> } catch (Exception ex) {
> System.out.println( ex.getMessage() );
> }
> }
> }
> //--------- End of TestIasJdbc.java -------------------------------
>
> The command to compile the code in a win32 shell is:
>
> javac -classpath "$ASANY9/java/jodbc.jar" TestIasJdbc.java
>
> The command to run the class is:
>
> java -classpath ".:$ASANY9/java/jodbc.jar" TestIasJdbc
>
>
>
>
> I have not played with JDK 1.5 on Linux yet, but if the above sample
> does not work please post back with details on the failure.
>
> Hope this helps,
> greg.fenton
Here what happens:
#
# An unexpected error has been detected by HotSpot Virtual Machine:
#
# SIGSEGV (0xb) at pc=0x400a7ee6, pid=17606, tid=1074006560
#
# Java VM: Java HotSpot(TM) Server VM (1.5.0_03-b07 mixed mode)
# Problematic frame:
# C [libc.so.6+0x66ee6] strcpy+0x26
#
# An error report file with more information is saved as hs_err_pid17606.log
#
# If you would like to submit a bug report, please visit:
# http://java.sun.com/webapps/bugreport/crash.jsp
#
Aborted
I have attached the full stack.
With the 1.4.2 JVM it also crashes
An unexpected exception has been detected in native code outside the VM.
Unexpected Signal : 11 occurred at PC=0x400A7EE6
Function=strcpy+0x26
Library=/lib/tls/libc.so.6
Current Java thread:
Segmentation fault
I did also set the LD_ASSUME_KERNEL=2.4.1, but it did also crash, but in
another module.
The server has two processors SMP
André
| |
| Andre Schild 2005-07-12, 3:23 am |
| I did now upgrade from 2552 to the 3133 build, but I still see the same
problems.
André
Andre Schild schrieb:
> Greg Fenton schrieb:
>
>
> Here what happens:
>
> #
> # An unexpected error has been detected by HotSpot Virtual Machine:
> #
> # SIGSEGV (0xb) at pc=0x400a7ee6, pid=17606, tid=1074006560
> #
> # Java VM: Java HotSpot(TM) Server VM (1.5.0_03-b07 mixed mode)
> # Problematic frame:
> # C [libc.so.6+0x66ee6] strcpy+0x26
> #
> # An error report file with more information is saved as
> hs_err_pid17606.log
> #
> # If you would like to submit a bug report, please visit:
> # http://java.sun.com/webapps/bugreport/crash.jsp
> #
> Aborted
>
> I have attached the full stack.
>
> With the 1.4.2 JVM it also crashes
>
> An unexpected exception has been detected in native code outside the VM.
> Unexpected Signal : 11 occurred at PC=0x400A7EE6
> Function=strcpy+0x26
> Library=/lib/tls/libc.so.6
>
> Current Java thread:
> Segmentation fault
>
>
>
> I did also set the LD_ASSUME_KERNEL=2.4.1, but it did also crash, but in
> another module.
>
> The server has two processors SMP
>
>
> André
>
| |
| David Fishburn 2005-07-13, 8:23 pm |
| Andre Schild <a.schild@aarboard.ch> wrote in news:42d241e3$1@foru
ms-1-dub
of sybase.public.sqlanywhere.linux:
AS> Is this a JDK 1.5 problem or what I'm missing ?
AS> I need the 1.5 version, since it's using JMX...
What happens when you try the same simple test program using JDK 1.4.x?
That would let you know pretty quickly if it is a machine
configuration issue, or a JDK version issue.
--
David Fishburn
Certified ASA Developer Version 8
iAnywhere Solutions - Sybase
Professional Services
Please only post to the newsgroup
Please ALWAYS include version and MORE importantly BUILD number with
EACH post (dbeng9 -v).
EBFs and Maintenance Releases
http://downloads.sybase.com/swx/sdmain.stm
Developer Community / Whitepapers
http://www.ianywhere.com/developer
CaseXpress - to report bugs
http://casexpress.sybase.com
CodeXchange - Free samples
[url]http://ianywhere.codexchange.sybase.com/servlets/ ProjectDocumentList[
/url]
| |
| Greg Fenton 2005-07-13, 8:23 pm |
| Andre Schild wrote:
> I did now upgrade from 2552 to the 3133 build, but I still see the same
> problems.
>
I am told that there has been no official testing of JDK 1.5 with ASA
9.0.2 on Linux. I am trying to get some time to try this out, but I
haven't been successful yesterday or today...sorry.
greg.fenton
--
Greg Fenton
Consultant, Solution Services, iAnywhere Solutions
--------
Visit the iAnywhere Solutions Developer Community
Whitepapers, TechDocs, Downloads
http://www.ianywhere.com/developer/
| |
| Andre Schild 2005-07-13, 8:23 pm |
| David Fishburn wrote:
> Andre Schild <a.schild@aarboard.ch> wrote in news:42d241e3$1@foru
ms-1-dub
> of sybase.public.sqlanywhere.linux:
>
> AS> Is this a JDK 1.5 problem or what I'm missing ?
> AS> I need the 1.5 version, since it's using JMX...
>
> What happens when you try the same simple test program using JDK 1.4.x?
> That would let you know pretty quickly if it is a machine
> configuration issue, or a JDK version issue.
>
The second stacktrace is from 1.4.2_06-b03, so it's not a 1.5 problem,
but something else.
André
| |
| Andre Schild 2005-07-13, 8:23 pm |
| Greg Fenton wrote:
> Andre Schild wrote:
>
> I am told that there has been no official testing of JDK 1.5 with ASA
> 9.0.2 on Linux. I am trying to get some time to try this out, but I
> haven't been successful yesterday or today...sorry.
>
It also crashes with 1.4.2_06-b03, look at the second stack trace.
Perhaps something SMP related.. ?
André
| |
| Andre Schild 2005-07-19, 3:23 am |
| Andre Schild schrieb:
> Greg Fenton wrote:
>
> It also crashes with 1.4.2_06-b03, look at the second stack trace.
>
> Perhaps something SMP related.. ?
>
> André
Has someone an idea on how to track down the problem ?
Looking trough the newsgroups and websites, jODBC seems to
not be used very much.
jODBC on linux even less...
André
| |
| Greg Fenton 2005-07-19, 9:23 am |
| Andre Schild wrote:
>
> Has someone an idea on how to track down the problem ?
>
Andre,
Sorry I have not been able to free up time to look into this. I suggest
you contact iAnywhere Technical Support if this is urgent. I likely
won't be looking at this anytime soon (customer site visits and vacation
coming up).
Recognize that the newsgroups are run on a voluntary basis. These are
not official support channels, so if you need a response or a fix the
best thing to do is open a case with Tech Support directly or via
CaseXpress (http://casexpress.sybase.com/).
> Looking trough the newsgroups and websites, jODBC seems to
> not be used very much. jODBC on linux even less...
>
There are a few reasons for this. The first is that there is precious
little documentation on the jODBC driver; This will be addressed in the
Jasper release of the docs. The second is that its namespace suggests
that this is a "MobiLink" technology, which it is *not*. Third, when it
was introduced in SQLAnywhere Studio 8.x, it was not the driver that the
Java tools used so many people stuck with jConnect; as of 9.x jODBC is
used by default. And lastly(?), jConnect has been around for a long
time so it has developers' mindshare.
I still urge people to consider using jODBC. You are getting crashes,
but the entire JVM is going down...this is not normal under any
circumstances. Any "native code" that I've worked with in Java on Linux
has at worst cause stack traces to dump. I have never seen a JVM go
down (reliably).
So please try working with Technical Support or posting exact steps for
a reproducible (including OS/kernel/glibc/JVM details) in case someone
does free up time to try this out.
greg.fenton
--
Greg Fenton
Consultant, Solution Services, iAnywhere Solutions
--------
Visit the iAnywhere Solutions Developer Community
Whitepapers, TechDocs, Downloads
http://www.ianywhere.com/developer/
| |
| Greg Fenton 2005-07-19, 11:23 am |
| Greg Fenton wrote:
>
> Sorry I have not been able to free up time to look into this.
Andre,
I was able to successfully autostart a database and connect using the
code below.
Here are the details of my system:
- JDK 1.5.0_03
- SuSE 9.3
- kernel 2.6.11-20a
- glibc-2.3.4-23.4
- ASA 9.0.2.3133
Here is the code:
//--------- Start of TestIasJdbc.java ----------------------------
import java.sql.*;
public class TestIasJdbc {
public static String ASANY9_DIR = "/opt/sybase/asa902";
public static String ASANY_ODBC_DRIVER = ASANY9_DIR +
"/lib/libdbodbc9_r.so";
public static String DB_DIR = ASANY9_DIR;
public static int SLEEP_MILLIS = 10000;
public static void main(String args[]) {
String driver, url;
Connection conn;
driver="ianywhere.ml.jdbcodbc.IDriver";
url = "jdbc:odbc:driver=" + ASANY_ODBC_DRIVER +
" ;uid=DBA;pwd=SQL;dbf
=" + DB_DIR + "/asademo.db";
try {
Class.forName( driver );
} catch (Exception ex) {
ex.printStackTrace();
System.exit(1);
}
try {
conn = DriverManager.getConnection( url );
if ( conn == null ) {
System.out.println("connection failed!");
System.exit(10);
}
} catch (Exception ex) {
ex.printStackTrace();
System.exit(2);
}
System.out.println("Sleeping for " + SLEEP_MILLIS + " msecs");
try {
Thread. sleep(SLEEP_MILLIS);
} catch (Exception ex) {
ex.printStackTrace();
System.exit(3);
}
System.out.println("Done.");
}
}
//--------- End of TestIasJdbc.java ------------------------------
--
Greg Fenton
Consultant, Solution Services, iAnywhere Solutions
--------
Visit the iAnywhere Solutions Developer Community
Whitepapers, TechDocs, Downloads
http://www.ianywhere.com/developer/
| |
| Andre Schild 2005-07-19, 8:24 pm |
| Greg Fenton schrieb:
> Greg Fenton wrote:
>
>
>
> Andre,
>
> I was able to successfully autostart a database and connect using the
> code below.
>
> Here are the details of my system:
> - JDK 1.5.0_03
> - SuSE 9.3
> - kernel 2.6.11-20a
> - glibc-2.3.4-23.4
> - ASA 9.0.2.3133
I currently setup two new servers (one test and one productive),
so I can do the tests there also. (They are not SMP systems)
I will give you feedback ASAP.
Thanks for all your help.
André
>
> Here is the code:
>
> //--------- Start of TestIasJdbc.java ----------------------------
> import java.sql.*;
>
> public class TestIasJdbc {
>
> public static String ASANY9_DIR = "/opt/sybase/asa902";
>
> public static String ASANY_ODBC_DRIVER = ASANY9_DIR +
> "/lib/libdbodbc9_r.so";
>
> public static String DB_DIR = ASANY9_DIR;
>
> public static int SLEEP_MILLIS = 10000;
>
> public static void main(String args[]) {
> String driver, url;
> Connection conn;
> driver="ianywhere.ml.jdbcodbc.IDriver";
> url = "jdbc:odbc:driver=" + ASANY_ODBC_DRIVER +
> " ;uid=DBA;pwd=SQL;dbf
=" + DB_DIR + "/asademo.db";
> try {
> Class.forName( driver );
> } catch (Exception ex) {
> ex.printStackTrace();
> System.exit(1);
> }
> try {
> conn = DriverManager.getConnection( url );
> if ( conn == null ) {
> System.out.println("connection failed!");
> System.exit(10);
> }
> } catch (Exception ex) {
> ex.printStackTrace();
> System.exit(2);
> }
>
> System.out.println("Sleeping for " + SLEEP_MILLIS + " msecs");
> try {
> Thread. sleep(SLEEP_MILLIS);
> } catch (Exception ex) {
> ex.printStackTrace();
> System.exit(3);
> }
> System.out.println("Done.");
> }
>
> }
>
> //--------- End of TestIasJdbc.java ------------------------------
>
|
|
|
|
|