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

[4901 byte] By [lavanya_299a] at [2007-11-27 1:41:59]
# 1

> java.lang.ClassNotFoundException: com.microsoft.jdbc.sqlserver.SQLServerDriver

This means your JDBC driver is not in the classpath of your application.

If you are going to make connections in your JDBC code (which incidentally is a violation of at least two best practice rules) then you can fix this by putting the jar file that contains the driver in the WEB-INF/lib directory of your web application.

DrClapa at 2007-7-12 0:58:00 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...
# 2
Thanks for the reply..could you tell me which jar file i need to copy to the tomcat folder?and also do i need to install any other driver patch to make the connection work...
lavanya_299a at 2007-7-12 0:58:00 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...
# 3
Copy following database driver files in TOMCAT-HOME/common/lib directory and restart tomcat.1.MSBASE.jar2.MSSQLSERVER.jar and 3.msutil.jar
sinhasinhaa at 2007-7-12 0:58:00 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...
# 4
Thanks for the reply..I have JDK 1.5 and Jre 1.6but i dont find the above jar files in any of these directories...should we install any thing apart from jdk to access the database?
lavanya_299a at 2007-7-12 0:58:00 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...
# 5
u can find those (msbase.jar,msutil.jar,mssqlserver.jar)files in c:/programfiles/MsSqlServer jdbc driver, or else download them....
sundar82a at 2007-7-12 0:58:00 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...