• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver]Optional feature not

 
Ranch Hand
Posts: 260
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have written a very simple servlet bt as soon I execute it, gives me an exception
>>java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver]Optional feature not implemented
at line >>>>>>>>>>>>> pstmt.setLong(1,id);

the comp code is....
package com.employee;
import java.sql.*;
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
import com.employee.*;
public class AddEmployeeServlet extends HttpServlet{
Connection conn;
private String name;
private String emailID;
private String emailAccount;
private String password;
private String dateCreated;
private String joinedDate;
private String resignedDate;
private String currentLocation;
private String lastLocation;
private String designation;
private boolean isResigned;
public void doGet(HttpServletRequest request,HttpServletResponse response) throws ServletException,IOException{
doPost(request,response);
}
public void doPost(HttpServletRequest request,HttpServletResponse response) throws ServletException,IOException{
String strJDate=request.getParameter("mmJoined")+"/"+request.getParameter("ddJoined")+"/"+request.getParameter("yyJoined");
String strRDate=request.getParameter("mmResigned")+"/"+request.getParameter("ddResigned")+"/"+request.getParameter("yyResigned");;
String strCDate=request.getParameter("mmCreated")+"/"+request.getParameter("ddCreated")+"/"+request.getParameter("yyCreated");;
// Calendar calendar = new GregorianCalendar(request.getParameter("joinDate"));
// Date dtJoin =new Date(request.getParameter("joinDate"));
// Date dtResignd =new Date(request.getParameter("resignedDare"));
// Date dtCreated =new Date(request.getParameter("deteCreated"));
PreparedStatement pstmt =null;
try{
HttpSession session=request.getSession();
System.out.println("Forwarding req>>>session:"+session);
if (session==null){response.sendRedirect("http://vijay:8080/emailuser/index.jsp");}
System.out.println("Forwarding req>>> after");
BoundConnection boundConnection=(BoundConnection)session.getValue("BOUNDCONNECTION");
conn=boundConnection.getConnection();
if (conn==null){
System.out.println("conn value>>>>:"+conn);
response.sendRedirect("index.jsp");
System.out.println("SOULD NOT DISPLAY:"+conn);
}
System.out.println("Hello");
name=request.getParameter("name");
emailID=request.getParameter("emailID");
emailAccount=request.getParameter("emailAccount");
password=request.getParameter("password");
// dateCreated=request.getParameter("joinDate");
// joinedDate=request.getParameter("resignedDate");
// resignedDate=request.getParameter("deteCreated");
currentLocation=request.getParameter("currentLocation");
lastLocation=request.getParameter("lastLocation");
designation=request.getParameter("designation");
if(request.getParameter("isResigned").equalsIgnoreCase("yes"))
isResigned=true;
else
isResigned=false;

long id=GetID.getID("employee","empid",conn)+1;
System.out.println("ID:"+id);
pstmt=this.conn.prepareStatement("INSERT INTO employee (empid,name,email,emailaccount,password,datejoined,dateresigned,datecreated,lastlocation,currentlocation,designation,resigned) VALUES (?,?,?,?,?,?,?,?,?,?,?,?)");
System.out.println("1100");
pstmt.setLong(1,id); // error line if I commented it then code is executed smoothly
System.out.println("100");
pstmt.setString(1,name);
System.out.println("101");
pstmt.setString(2,emailID);
System.out.println("102");
pstmt.setString(3,emailAccount);
System.out.println("103");
pstmt.setString(4,password);
System.out.println("104");
pstmt.setString(5,strJDate);
pstmt.setString(6,strRDate);
pstmt.setString (7,strCDate);
System.out.println("105");

System.out.println("106");

System.out.println("107");
pstmt.setString(8,currentLocation);
System.out.println("108");
pstmt.setString(9,lastLocation);
System.out.println("109");
pstmt.setString(10,designation);
System.out.println("110");
pstmt.setBoolean(11,isResigned);
System.out.println("111");
pstmt.executeUpdate();
pstmt.close();
pstmt=null;
}catch(SQLException ex){System.out.println("Exception:"+ex);response.sendRedirect("index.jsp");}
catch(Exception ex){System.out.println("Super Exception:"+ex);response.sendRedirect("index.jsp");}
finally{

}

}


}

thanks
 
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The Exception is telling you all you need to know: your driver does not support the setLong() method. Remember that the core of JDBC is basically a bunch of interfaces, and it is up to Driver implementer to add support for the functionality included in these interfaces. If they can't/won't then which ever method will throw an UnsupportedOperationException.
 
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"javasavvy", please read the warning about your display name here. Accounts with invalid display names get deleted, often withour warning

Dave
 
reply
    Bookmark Topic Watch Topic
  • New Topic