Hi Guys
I am getting "javawebserver: SQLException in Driver Sharif:
[Microsoft][ODBC Driver Manager] Function sequence error " when i am trying
to access MS-Access Database. i have jdk 1.3, Windows 98, MS-Access97. It
was working fine few days ago but started giving this problem every time i
use it.
Please help
Thanx
Code starts here
import java.io.*;
import java.util.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.sql.*;
import java.text.*;
public class SharifAttendanceServlet extends HttpServlet {
String eName;
String eId;
String user;
String epass;
protected void doPost
(HttpServletRequest req, HttpServletResponse res)
throws ServletException{
try{
eName = req.getParameter("user");
epass = req.getParameter("password");
res.setContentType("text/html");
PrintWriter out = res.getWriter();
try {
CallSharif(out);
}catch(Exception e) {
System.err.print("Sharif: MS-ACESS Connecting database:");
System.err.println(e.getMessage());
}
}catch(Exception e) {
log(e.toString());
throw new ServletException(e.getMessage());
}
}
protected void CallSharif(PrintWriter tout) {
String url = "sun.jdbc.odbc.JdbcOdbcDriver";
Connection con;
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
} catch(java.lang.ClassNotFoundException e) {
tout.println("<h2>Sharif: ClassNotFoundException: <h2>");
System.err.print("Sharif: ClassNotFoundException: ");
}
try {
con = DriverManager.getConnection("jdbc:odbc:SharifFirst","","sharif");
PreparedStatement updateEmployee;
String selectString = "select UserID,Password " +
"from EMPLOYEE " +
"where UserID = ? ";
updateEmployee = con.prepareStatement(selectString);
updateEmployee.setString(1,eName);
ResultSet rs = updateEmployee.executeQuery();
int rowCount = 0;
while(rs.next())
rowCount++;
rs.close();
updateEmployee.clearParameters();
if( rowCount == 1) {
String passWord = rs.getString(2);
String userId = rs.getString(1);
tout.println("<h2>Sharif: Password for " + userId + " is: " +
passWord);
}
if( rowCount == 0)
tout.println("\n<h2>Sharif: UserID " + eName + " not found in
database");
con.close();
} catch(SQLException ex) {
tout.println("<h2>SQLException in Driver Sharif: <h2>");
tout.println(ex.getMessage());
System.err.print("SQLException in Driver Sharif: ");
System.err.println(ex.getMessage());
}
}
}
________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html