I am running on Win2k OS, Tomcat 4 Application
server and MS SQL Server 2k
as DB. I have made an ODBC connection and dns is manu. I am running the
following code as per your instructions and i am getting some errors
displayed below the code ). Please tell me where's the mistake.
Thanx in advance
Jyoti.
<html>
<head>
<title>Manu Collection</title>
<script language="JavaScript">
function butFn(buttonAction,submitPage)
{
if(buttonAction=="Back" || buttonAction=="First" || buttonAction=="Prev"
|| buttonAction=="Next" || buttonAction=="Last")
{
document.reader.action=submitPage;
document.reader.submit();
}
}
</script>
</head>
<%@ page language="java" import="java.sql.*" %>
<body>
<h1>Manu Collection</h1>
<%
int inc = 0;
String from=request.getParameter("from");
if (from=="F") { inc=1; }
else if(from=="P") { inc=Integer.parseInt(request.getParameter("inc")); }
else if(from=="N") { inc=Integer.parseInt(request.getParameter("inc")); }
else if(from=="L") { inc=-1; }
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection myConn = DriverManager.getConnection("jdbc:odbc:manu");
as DB. I have made an ODBC connection and dns is manu. I am running the
following code as per your instructions and i am getting some errors
displayed below the code ). Please tell me where's the mistake.
Thanx in advance
Jyoti.
<html>
<head>
<title>Manu Collection</title>
<script language="JavaScript">
function butFn(buttonAction,submitPage)
{
if(buttonAction=="Back" || buttonAction=="First" || buttonAction=="Prev"
|| buttonAction=="Next" || buttonAction=="Last")
{
document.reader.action=submitPage;
document.reader.submit();
}
}
</script>
</head>
<%@ page language="java" import="java.sql.*" %>
<body>
<h1>Manu Collection</h1>
<%
int inc = 0;
String from=request.getParameter("from");
if (from=="F") { inc=1; }
else if(from=="P") { inc=Integer.parseInt(request.getParameter("inc")); }
else if(from=="N") { inc=Integer.parseInt(request.getParameter("inc")); }
else if(from=="L") { inc=-1; }
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection myConn = DriverManager.getConnection("jdbc:odbc:manu");
// Error might be here
Statement stmt = myConn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,
ResultSet.CONCUR_UPDATABLE);
String qry="";
ResultSet myResultSet=null;
if(inc==0) {
qry="select * from tblMS";
myResultSet = stmt.executeQuery(qry);
myResultSet.absolute(inc);
session.setAttribute("rsSession",myResultSet);
} else if(inc>0) {
myResultSet=(ResultSet)session.getAttribute("rsSession");
myResultSet.absolute(inc);
}
String MSID = myResultSet.getString("MSID");
String msOldNo = myResultSet.getString("msOldNo");
String msTitle = myResultSet.getString("msTitle");
String msAuthor = myResultSet.getString("msAuthor");
%>
<FORM NAME="reader">
<table width="75%" border="1">
<tr>
<td>MSID</td>
<td>
<input type="text" name="txtMSID" value="<%= MSID %>">
</td>
<td>msOldNo</td>
<td>
<input type="text" name="txtmsOldNo" value="<%= msOldNo %>">
</td>
</tr>
<tr>
<td>msTitle</td>
<td>
<input type="text" name="txtmsTitle" value="<%= msTitle %>">
</td>
<td>msAuthor</td>
<td>
<input type="text" name="txtmsAuthor" value="<%= msAuthor %>">
</td>
</tr>
<tr>
<td colspan="4">
<div align="center">
<input type="button" name="butFirst" value="First"
>
<input type="button" name="butPrev" value="Prev">
<input type="button" name="butNext" value="Next">
<input type="button" name="butLast" value="Last">
</div>
</td>
</tr>
</table>
</form>
</body>
</html>
A Servlet Exception Has Occurred
Exception Report:
javax.servlet.ServletException: [Microsoft][ODBC SQL Server Driver]Optional
feature not implemented
at
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImp
l.java:457)
at org.apache.jsp.manutst$jsp._jspService(manutst$jsp.java:133)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:1264)
at
org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.ja
va:201)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:381)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:473)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:1264)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
FilterChain.java:247)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
ain.java:193)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.ja
va:243)
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
66)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.ja
va:215)
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
66)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at
org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2366)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164
)
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
66)
at
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:462)
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
64)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java
:163)
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
66)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at
org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:
1005)
at
org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1098
)
at java.lang.Thread.run(Unknown Source)
Root Cause:
java.sql.SQLException: [Microsoft][ODBC SQL Server Driver]Optional feature
not implemented
at sun.jdbc.odbc.JdbcOdbc.createSQLException(Unknown Source)
at sun.jdbc.odbc.JdbcOdbc.standardError(Unknown Source)
at sun.jdbc.odbc.JdbcOdbc.SQLExecDirect(Unknown Source)
at sun.jdbc.odbc.JdbcOdbcStatement.execute(Unknown Source)
at sun.jdbc.odbc.JdbcOdbcStatement.executeQuery(Unknown Source)
at org.apache.jsp.manutst$jsp._jspService(manutst$jsp.java:84)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:1264)
at
org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.ja
va:201)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:381)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:473)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:1264)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
FilterChain.java:247)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
ain.java:193)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.ja
va:243)
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
66)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.ja
va:215)
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
66)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at
org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2366)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164
)
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
66)
at
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:462)
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
64)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java
:163)
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
66)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at
org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:
1005)
at
org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1098
)
at java.lang.Thread.run(Unknown Source)
Statement stmt = myConn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,
ResultSet.CONCUR_UPDATABLE);
String qry="";
ResultSet myResultSet=null;
if(inc==0) {
qry="select * from tblMS";
myResultSet = stmt.executeQuery(qry);
myResultSet.absolute(inc);
session.setAttribute("rsSession",myResultSet);
} else if(inc>0) {
myResultSet=(ResultSet)session.getAttribute("rsSession");
myResultSet.absolute(inc);
}
String MSID = myResultSet.getString("MSID");
String msOldNo = myResultSet.getString("msOldNo");
String msTitle = myResultSet.getString("msTitle");
String msAuthor = myResultSet.getString("msAuthor");
%>
<FORM NAME="reader">
<table width="75%" border="1">
<tr>
<td>MSID</td>
<td>
<input type="text" name="txtMSID" value="<%= MSID %>">
</td>
<td>msOldNo</td>
<td>
<input type="text" name="txtmsOldNo" value="<%= msOldNo %>">
</td>
</tr>
<tr>
<td>msTitle</td>
<td>
<input type="text" name="txtmsTitle" value="<%= msTitle %>">
</td>
<td>msAuthor</td>
<td>
<input type="text" name="txtmsAuthor" value="<%= msAuthor %>">
</td>
</tr>
<tr>
<td colspan="4">
<div align="center">
<input type="button" name="butFirst" value="First"
>
<input type="button" name="butPrev" value="Prev">
<input type="button" name="butNext" value="Next">
<input type="button" name="butLast" value="Last">
</div>
</td>
</tr>
</table>
</form>
</body>
</html>
A Servlet Exception Has Occurred
Exception Report:
javax.servlet.ServletException: [Microsoft][ODBC SQL Server Driver]Optional
feature not implemented
at
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImp
l.java:457)
at org.apache.jsp.manutst$jsp._jspService(manutst$jsp.java:133)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:1264)
at
org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.ja
va:201)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:381)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:473)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:1264)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
FilterChain.java:247)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
ain.java:193)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.ja
va:243)
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
66)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.ja
va:215)
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
66)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at
org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2366)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164
)
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
66)
at
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:462)
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
64)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java
:163)
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
66)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at
org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:
1005)
at
org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1098
)
at java.lang.Thread.run(Unknown Source)
Root Cause:
java.sql.SQLException: [Microsoft][ODBC SQL Server Driver]Optional feature
not implemented
at sun.jdbc.odbc.JdbcOdbc.createSQLException(Unknown Source)
at sun.jdbc.odbc.JdbcOdbc.standardError(Unknown Source)
at sun.jdbc.odbc.JdbcOdbc.SQLExecDirect(Unknown Source)
at sun.jdbc.odbc.JdbcOdbcStatement.execute(Unknown Source)
at sun.jdbc.odbc.JdbcOdbcStatement.executeQuery(Unknown Source)
at org.apache.jsp.manutst$jsp._jspService(manutst$jsp.java:84)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:1264)
at
org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.ja
va:201)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:381)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:473)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:1264)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
FilterChain.java:247)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
ain.java:193)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.ja
va:243)
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
66)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.ja
va:215)
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
66)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at
org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2366)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164
)
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
66)
at
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:462)
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
64)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java
:163)
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
66)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at
org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:
1005)
at
org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1098
)
at java.lang.Thread.run(Unknown Source)