Results 1 to 2 of 2
  1. #1
    Join Date
    Sep 2003
    Location
    New Delhi, India
    Posts
    1

    Question Unanswered: jdbc with unixodbc

    Hi

    I am looking for some help.

    I have to connect to an access database thru Java using unixodbc.
    When I use isql tool everything is fine. I can connect
    to my database.

    $ isql -v DSN_Name username passwd
    +---------------------------------------+
    | Connected! |
    | sql-statement |
    | help [tablename] |
    | quit |
    +---------------------------------------+
    SQL>

    However when i try to connect thru my java programme i get a strange run time error..
    here is the error:

    An unexpected exception has been detected in native code outside the VM.
    Unexpected Signal : 11 occurred at PC=0x4C5E11D7
    Function=mdb_fetch_row+0x17
    Library=/usr/lib/libmdbodbc.so.0

    Current Java thread:
    at sun.jdbc.odbc.JdbcOdbc.fetch(Native Method)
    at sun.jdbc.odbc.JdbcOdbc.SQLFetch(JdbcOdbc.java:3125 )
    at sun.jdbc.odbc.JdbcOdbcResultSet.next(JdbcOdbcResul tSet.java:1295)
    at sun.jdbc.odbc.JdbcOdbcConnection.buildTypeInfo(Jdb cOdbcConnection.java:1498)
    at sun.jdbc.odbc.JdbcOdbcConnection.initialize(JdbcOd bcConnection.java:381)
    at sun.jdbc.odbc.JdbcOdbcDriver.connect(JdbcOdbcDrive r.java:174)
    - locked <0x442331c8> (a sun.jdbc.odbc.JdbcOdbcDriver)
    at java.sql.DriverManager.getConnection(DriverManager .java:512)
    - locked <0x483103f0> (a java.lang.Class)
    at java.sql.DriverManager.getConnection(DriverManager .java:171)
    - locked <0x483103f0> (a java.lang.Class)
    at jdbc.main(jdbc.java:14)

    Dynamic libraries:
    08048000-0804e000 r-xp 00000000 03:42 734853 /usr/java/j2sdk1.4.1_05/bin/java
    0804e000-0804f000 rw-p 00005000 03:42 734853 /usr/java/j2sdk1.4.1_05/bin/java
    40000000-40012000 r-xp 00000000 03:42 342080 /lib/ld-2.3.2.so
    40012000-40013000 rw-p 00011000 03:42 342080 /lib/ld-2.3.2.so
    40013000-4001b000 r-xp 00000000 03:42 554897 /usr/java/j2sdk1.4.1_05/jre/lib/i386/native_threads/libhpi.so
    4001b000-4001c000 rw-p 00007000 03:42 554897 /usr/java/j2sdk1.4.1_05/jre/lib/i386/native_threads/libhpi.so
    4001c000-40026000 r-xp 00000000 03:42 342101 /lib/libnss_files-2.3.2.so
    40026000-40027000 rw-p 00009000 03:42 342101 /lib/libnss_files-2.3.2.so
    40028000-40036000 r-xp 00000000 03:42 342109 /lib/libpthread-0.10.so
    40036000-40039000 rw-p 0000e000 03:42 342109 /lib/libpthread-0.10.so
    40079000-4007b000 r-xp 00000000 03:42 342091 /lib/libdl-2.3.2.so
    4007b000-4007c000 rw-p 00001000 03:42 342091 /lib/libdl-2.3.2.so
    4007c000-4019b000 r-xp 00000000 03:42 342087 /lib/libc-2.3.2.so
    4019b000-4019f000 rw-p 0011e000 03:42 342087 /lib/libc-2.3.2.so
    401a1000-40455000 r-xp 00000000 03:42 1223469 /usr/java/j2sdk1.4.1_05/jre/lib/i386/client/libjvm.so
    40455000-40635000 rw-p 002b3000 03:42 1223469 /usr/java/j2sdk1.4.1_05/jre/lib/i386/client/libjvm.so
    40645000-40655000 r-xp 00000000 03:42 342095 /lib/libnsl-2.3.2.so
    40655000-40656000 rw-p 00010000 03:42 342095 /lib/libnsl-2.3.2.so
    40658000-40678000 r-xp 00000000 03:42 342093 /lib/libm-2.3.2.so
    40678000-40679000 rw-p 00020000 03:42 342093 /lib/libm-2.3.2.so
    40679000-40689000 r-xp 00000000 03:42 652274 /usr/java/j2sdk1.4.1_05/jre/lib/i386/libverify.so
    40689000-4068b000 rw-p 0000f000 03:42 652274 /usr/java/j2sdk1.4.1_05/jre/lib/i386/libverify.so
    4068b000-406ac000 r-xp 00000000 03:42 652261 /usr/java/j2sdk1.4.1_05/jre/lib/i386/libjava.so
    406ac000-406ae000 rw-p 00020000 03:42 652261 /usr/java/j2sdk1.4.1_05/jre/lib/i386/libjava.so
    406ae000-406c2000 r-xp 00000000 03:42 652275 /usr/java/j2sdk1.4.1_05/jre/lib/i386/libzip.so
    406c2000-406c5000 rw-p 00013000 03:42 652275 /usr/java/j2sdk1.4.1_05/jre/lib/i386/libzip.so
    406c5000-41d9a000 r--s 00000000 03:42 50744 /usr/java/j2sdk1.4.1_05/jre/lib/rt.jar
    41ddd000-41df4000 r--s 00000000 03:42 50745 /usr/java/j2sdk1.4.1_05/jre/lib/sunrsasign.jar
    41df4000-41e66000 r--s 00000000 03:42 50738 /usr/java/j2sdk1.4.1_05/jre/lib/jsse.jar
    41e66000-41e79000 r--s 00000000 03:42 50737 /usr/java/j2sdk1.4.1_05/jre/lib/jce.jar
    41e79000-42141000 r--s 00000000 03:42 50725 /usr/java/j2sdk1.4.1_05/jre/lib/charsets.jar
    441e9000-441ec000 r--s 00000000 03:42 1076914 /usr/java/j2sdk1.4.1_05/jre/lib/ext/dnsns.jar
    441ec000-441ed000 rw-s 00000000 00:04 425988 /SYSV794242c3 (deleted)
    441ed000-441ee000 r-xp 00000000 03:42 456230 /usr/lib/gconv/ISO8859-1.so
    441ee000-441ef000 rw-p 00000000 03:42 456230 /usr/lib/gconv/ISO8859-1.so
    4c270000-4c470000 r--p 00000000 03:42 456097 /usr/lib/locale/locale-archive
    4c470000-4c50f000 r--s 00000000 03:42 1076916 /usr/java/j2sdk1.4.1_05/jre/lib/ext/localedata.jar
    4c50f000-4c51d000 r--s 00000000 03:42 1076915 /usr/java/j2sdk1.4.1_05/jre/lib/ext/ldapsec.jar
    4c51d000-4c53a000 r--s 00000000 03:42 1076917 /usr/java/j2sdk1.4.1_05/jre/lib/ext/sunjce_provider.jar
    4c53a000-4c549000 r-xp 00000000 03:42 652252 /usr/java/j2sdk1.4.1_05/jre/lib/i386/libJdbcOdbc.so
    4c549000-4c54a000 rw-p 0000e000 03:42 652252 /usr/java/j2sdk1.4.1_05/jre/lib/i386/libJdbcOdbc.so
    4c54a000-4c550000 r--s 00000000 03:42 456286 /usr/lib/gconv/gconv-modules.cache
    4c55e000-4c56e000 r-xp 00000000 03:42 344414 /usr/lib/libodbcinst.so.1.0.0
    4c56e000-4c56f000 rw-p 0000f000 03:42 344414 /usr/lib/libodbcinst.so.1.0.0
    4c56f000-4c5d0000 r-xp 00000000 03:42 344404 /usr/lib/libodbc.so.1.0.0
    4c5d0000-4c5d5000 rw-p 00060000 03:42 344404 /usr/lib/libodbc.so.1.0.0
    4c5d5000-4c5e6000 r-xp 00000000 03:42 344424 /usr/lib/libmdbodbc.so.0.0.0
    4c5e6000-4c5e8000 rw-p 00010000 03:42 344424 /usr/lib/libmdbodbc.so.0.0.0
    4c608000-4c62c000 r-xp 00000000 03:42 342156 /usr/lib/libglib-1.2.so.0.0.10
    4c62c000-4c62d000 rw-p 00024000 03:42 342156 /usr/lib/libglib-1.2.so.0.0.10

    Local Time = Wed Sep 24 09:29:45 2003
    Elapsed Time = 3
    #
    # The exception above was detected in native code outside the VM
    #
    # Java VM: Java HotSpot(TM) Client VM (1.4.1_05-b01 mixed mode)
    #
    # An error report file has been saved as hs_err_pid2607.log.
    # Please refer to the file for further information.
    #
    Aborted
    ...


    My java code is :

    try
    {
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    System.out.println("so far so good");
    String user = "";
    String pass = "";
    Connection con = DriverManager.getConnection("jdbcdbc:MicrosoftAccess",user,pass);
    System.out.println("connection estalished");
    String query = "select * from emp";
    Statement stm = con.createStatement();
    ResultSet res = stm.executeQuery(query);
    while(res.next())
    {
    System.out.println(res.getString(1));
    }
    stm.close();
    con.close();
    }
    catch(Exception e)
    {
    e.printStackTrace();
    }

    Thanks in advance for all your help....

  2. #2
    Join Date
    Dec 2003
    Posts
    1
    Did you find a solution ?
    I have the exact problem

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •