[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Using JDBC-ODBC bridge

Posted on 1999-01-07
4
Medium Priority
?
926 Views
Last Modified: 2012-06-27
When trying to get a connection over the JDBC-ODBC bridge to an MS Access DB I get an error "Unable to load JdbcOdbc library". The Access ODBC driver is properly installed, since I can connect to the DB using a different prog. language. In the JDBC manual it says there was no special install procedure necessary to enable JDBC-ODBC. Below there's a dump of the messages displayed. The JdbcOdbc.dll (if this is meant by "JdbcOdbc library") is in the DLL search path, I even copied it to the current directory. What's going wrong? Thanks for any help.

Sidi

JdbcOdbcDriver class loaded
DriverManager.initialize: jdbc.drivers = null
JDBC DriverManager initialized
registerDriver: driver[className=sun.jdbc.odbc.JdbcOdbcDriver,context=null,sun.jdbc.odbc.JdbcOdbcDriver@13]
DriverManager.getConnection("jdbc:odbc:JDBCAccess")
    trying driver[className=sun.jdbc.odbc.JdbcOdbcDriver,context=null,sun.jdbc.odbc.JdbcOdbcDriver@13]
*Driver.connect (jdbc:odbc:JDBCAccess)
JDBC to ODBC Bridge: Checking security
No SecurityManager present, assuming trusted application/applet
JDBC to ODBC Bridge 1.2001
Current Date/Time: Wed Jan 06 19:07:34 GMT+01:00 1999
Loading JdbcOdbc library
Unable to load JdbcOdbc library
java.sql.SQLException: Unable to load JdbcOdbc library
      at sun/jdbc/odbc/JdbcOdbc.<init> (JdbcOdbc.java:88)
      at sun/jdbc/odbc/JdbcOdbcDriver.initialize (JdbcOdbcDriver.java:315)
      at sun/jdbc/odbc/JdbcOdbcDriver.connect (JdbcOdbcDriver.java:153)
      at java/sql/DriverManager.getConnection (DriverManager.java:91)
      at java/sql/DriverManager.getConnection (DriverManager.java:0)

0
Comment
Question by:sidi010799
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 

Expert Comment

by:T38Jet
ID: 1230616
I had that same problem and "fixed" it. But after I got Java to connect to the Access database, my machine would crash every time I tried to open the same database with Access again. I finally had to "wipe-and-load" my machine to get rid of the JDBC stuff.

But if I remember correctly, it had something to do with the connection string and/or a DSN for the database.
0
 
LVL 16

Accepted Solution

by:
heyhey_ earned 300 total points
ID: 1230617
the code snippet that throws the exception (from sun.jdbc.JdbcOdbc.class) is

    JdbcOdbcObject.trace("JDBC to ODBC Bridge " + 1 + "." + s1);
    JdbcOdbcObject.trace("Current Date/Time: " + date.toString());
    JdbcOdbcObject.trace("Loading " + s + "JdbcOdbc library");
    }
    System.loadLibrary(s + "JdbcOdbc");
    return;
    }
    catch(UnsatisfiedLinkError ex) {}
    if(JdbcOdbcObject.isTracing())
    JdbcOdbcObject.trace("Unable to load " + s + "JdbcOdbc library");
    throw new SQLException("Unable to load " + s + "JdbcOdbc library");
    }

as you can see the exception is thrown from this line:
  System.loadLibrary(s + "JdbcOdbc");
(where s is a 'native prefix' - as you can see in the trace s is empty string)

'public static void loadLibrary(String libname)
Loads the system library specified by the libname argument.
The manner in which a library name is mapped to the actual system library
is system dependent.

Parameters:
libname - the name of the library.
Throws: SecurityException
if the current thread cannot load the specified dynamic library.
Throws: UnsatisfiedLinkError
if the library does not exist.'

the exception UnsatisfiedLinkError so there are some problems with the native library loading.
if you are Windows user, this is (probably) JDBCODBC.DLL

so this sure is some kind of installation problem (Windows installation / or JDK installation).
(JDBCODBC.DLL uses several other - probably system - DLLs)

Note: I have never experinced problems with JdbcOdbc bridge in JDK1.1.

If you have more questions, please post them here.

best regards
  heyhey
 
P.S.
At the moment I have installed version of JDK1.1.6
and I have two DLL files in the jdk\bin directory (which is in my path)
e:\java\jdk1.1.6\bin>dir jdbc*.*

 Directory of  E:\java\jdk1.1.6\bin\jdbc*.*
 4-16-98   6:53          21,504  JdbcOdbc.dll
 4-16-98   6:54          22,016  JdbcOdbc_g.dll
         43,520 bytes in 2 files and 0 dirs    65,536 bytes allocated


0
 
LVL 16

Expert Comment

by:heyhey_
ID: 1230618
btw - what is your platform, jdk version, etc.
0
 

Author Comment

by:sidi010799
ID: 1230619
Thanks for the answers. Seeing the code snippet where the exception is thrown was definitely helpful to get the details. As I had stated in my question, though, I had put the DLL about everywhere the program might possibly look for it. I have solved the problem in the meantime: I was using MS J++ 6.0 to compile the code (sorry for not mentioning this in the question) and then running the program from the command line using MS' jview VM. I used jview because using the Sun VM (JDK1.2) gave me an error right at the beginning. After a while I got to the idea to compile the whole program using the JDK1.2 javac command and - wow - the library loaded correctly. Looks like another example of incompatibility between the different VMs.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses

649 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question