The JDBCODBC servlet works great when run by calling it from a local
Java application.
(I also have had success in getting the servlet to open a dbAnywhere
connection from a browser using the Fastrack server, but this is a
different mechanism because it uses a different driver that doesn't
require a native library, i.e. it's pure Java, and the classes
are simply put in the Netscape local-classes directory)
However direct JDBCODBC bridge connections from the server have been
a no win situation.
When I do a DriverManager.setLogStream(new FileOutputStream("jdbc.log"))
just before doing the DriverManager.getConnection(url,properties),
I find that I get the following log.
DriverManager.getConnection("jdbc:odbc:MyDatabase")
trying
driver[className=sun.jdbc.odbc.JdbcOdbcDriver,context=null,sun.jdbc.odbc.JdbcOdbcDriver@400138e8]
*Driver.connect (jdbc:odbc:MyDatabase)
JDBC to ODBC Bridge: Checking security
No SecurityManager present, assuming trusted application/applet
JDBC to ODBC Bridge 1.2001
Current Date/Time: Wed Jul 23 08:23:57 1997
Loading JdbcOdbc library
Unable to load JdbcOdbc library
java.sql.SQLException: Unable to load JdbcOdbc library
at sun.jdbc.odbc.JdbcOdbc.<init>(JdbcOdbc.java:91)
at sun.jdbc.odbc.JdbcOdbcDriver.initialize(JdbcOdbcDriver.java:321)
at sun.jdbc.odbc.JdbcOdbcDriver.connect(JdbcOdbcDriver.java:159)
at java.sql.DriverManager.getConnection(DriverManager.java:90)
..etc stack trace....
Unable to load JdbcOdbc library
Unable to allocate environment
getConnection: no suitable driver
java.sql.SQLException: No suitable driver
at java.sql.DriverManager.getConnection(DriverManager.java:110)
...etc stack trace...
This first error disquises itself as a SQLException: No Suitable driver
message, so the log was very useful.
I can duplicate this with the local servlet by deleting the jdbcodbc.dll
file in it's path, so it looks like the JdbcOdbc.class cannot find
the dll. However it's in my path and just about every other directory,
including the Java/bin directory for Netscape server (in the plugins),
the class directories themselves, the WINDOWS\SYSTEM directory, the
Netscape classes directory, the Netscape local-classes directory
(both in plugins) even the servlet directory has been tried.
Question: Has anyone successfully implemented anything similar to this.
If this worked it's a very viable alternative to using any sort of
pure Java driver to access an ODBC compliant database, because the
servlet can be put on the same system as a database. i.e. if Java can
access a database with a local JdbcOdbc application, then this would
work with any server that was servlet compliant including Netscape, IIS
and JavaServer.
Netscape's server products do not yet support JNI as far as I
know. The JDBC-ODBC bridge depends on JNI.
Thornton