Can any please help me..trying to connect to sql server 2000
Hi,
I am a begginer with the database and jsp.
I am trying to connect to the sql server using jsp and compling jsp using tomcat 5.0
jdk version is 1.5 and jre version is 6.
and also i have added CATALINA HOME and JAVA_HOME in the environmental variables.
my program is as follows:
--casenotes.jsp
<html>
<body>
<table>
<tr>
<td>
<jsp:include page="menu.html"/>
</td>
<%-- Set the scripting language to java and --%>
<%-- import the java.sql package --%>
<%@ page language="java" import="java.sql.*" %>
<%
try
{
//Load SQL server Drvier class file
Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");
//Make a connection to the oracle datasource
Connection conn = DriverManager.getConnection("jdbc:microsoft:sqlserver://server1:1433;"+"SelectMethod=cursor");
%>
<%
// Create the statement
Statement statement = conn.createStatement();
//Use the statement to SELECT the student attribute FROM the student table
ResultSet rs = statement.executeQuery("SELECT * FROM Student");
%>
<table>
<tr>
<th>SSN</th>
<th>First</th>
<th>Last</th>
<th>College</th>
</tr>
<%
//Iterate over the ResultSet
while(rs.next())
{
%>
<tr>
<%-- Get the SSN, which is a number --%>
<td><%=rs.getInt("SSN") %></td>
<%--Get the FirstName --%>
<td><%= rs.getString("FIRSTNAME") %></td>
<%--Get the LastName --%>
<td><%= rs.getString("LASTNAME") %></td>
<%--Get the College --%>
<td><%= rs.getString("COLLEGE") %></td>
</tr>
<%
}
%>
</table>
<%
//Close the Result Set
rs.close();
//Close the Statement
statement.close();
}
catch(SQLException sqle)
{
out.println(sqle.getMessage());
}
%>
</td>
</tr>
</table>
</body>
</html>
and i have put the casenotes.jsp in tomcat directory webapps\ROOT
and copied the tools.jar to tomcat directory COMMON\lib
when i try to access the casenotes.jsp through the internet explorer
http://localhost:8080/casenotes.jsp
but it gives this error message
HTTP Status 500 -
--
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
javax.servlet.ServletException: com.microsoft.jdbc.sqlserver.SQLServerDriver
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:825)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:758)
org.apache.jsp.casenotes_jsp._jspService(casenotes_jsp.java:178)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:298)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
root cause
java.lang.ClassNotFoundException: com.microsoft.jdbc.sqlserver.SQLServerDriver
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1340)
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1189)
org.apache.jasper.servlet.JasperLoader.loadClass(JasperLoader.java:148)
org.apache.jasper.servlet.JasperLoader.loadClass(JasperLoader.java:69)
java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
java.lang.Class.forName0(Native Method)
java.lang.Class.forName(Class.java:164)
org.apache.jsp.casenotes_jsp._jspService(casenotes_jsp.java:64)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:298)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
note The full stack trace of the root cause is available in the Apache Tomcat/5.0.25 logs.
can anyone please help me
Thanks
lavanya

