pepperjones
Programmer
I have recently implemented Tomcat 3.2.2 on a linux RAQ4 server with admin privilages. The test code below should connect me to an MicrosoftAccess database, it works on my local host which is windows by the way. (more explaination after code)
<%@ page import="javax.servlet.*,java.sql.*,java.util.*" %>
<%
Connection con ;
Statement stmt;
ResultSet rs;
String dishes = null;
String course = "Soups";
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver".newInstance();
con = DriverManager.getConnection("jdbcdbcRIVER={Microsoft Access Driver (*.mdb)};DBQ=/home/sites/site27/web/Recipes.mdb"
stmt = con.createStatement();
stmt.executeQuery("tblRecipes"
while(stmt.getResultSet().next() )
{
dishes = stmt.getResultSet().getString("course"
%>
The dish is: <%= dishes %> <br>
<%
}
}
catch(SQLException e){ e.printStackTrace(); }
%>
I get the error Internal Servlet Error:
javax.servlet.ServletException: Unable to load class sun.jdbc.odbc.JdbcOdbcDriver
and also the error
Root cause:
java.lang.ClassNotFoundException: Unable to load class sun.jdbc.odbc.JdbcOdbcDriver
I have changed the file in /etc/profile.d/java.sh classpaths to point to all relevant .jar files including rt.jar(which contains the jdbc driver doesnt it??), this is located in /usr/jdk1.3.1/jre/lib/rt.jar).
I have tried using the newInstance() and tried it without, i have rebooted the server and restarted tomcat but nothing works. Help help HELP HELP!!!!
<%@ page import="javax.servlet.*,java.sql.*,java.util.*" %>
<%
Connection con ;
Statement stmt;
ResultSet rs;
String dishes = null;
String course = "Soups";
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver".newInstance();
con = DriverManager.getConnection("jdbcdbcRIVER={Microsoft Access Driver (*.mdb)};DBQ=/home/sites/site27/web/Recipes.mdb"
stmt = con.createStatement();
stmt.executeQuery("tblRecipes"
while(stmt.getResultSet().next() )
{
dishes = stmt.getResultSet().getString("course"
%>
The dish is: <%= dishes %> <br>
<%
}
}
catch(SQLException e){ e.printStackTrace(); }
%>
I get the error Internal Servlet Error:
javax.servlet.ServletException: Unable to load class sun.jdbc.odbc.JdbcOdbcDriver
and also the error
Root cause:
java.lang.ClassNotFoundException: Unable to load class sun.jdbc.odbc.JdbcOdbcDriver
I have changed the file in /etc/profile.d/java.sh classpaths to point to all relevant .jar files including rt.jar(which contains the jdbc driver doesnt it??), this is located in /usr/jdk1.3.1/jre/lib/rt.jar).
I have tried using the newInstance() and tried it without, i have rebooted the server and restarted tomcat but nothing works. Help help HELP HELP!!!!