*.java can connect with JDBC, but *.JSP can not connect with JDBC

hi, Here is my problem

My ''Testconnect.java'' file works well. it could connect a JDBC.
But when I copy the same code to  test.asp file, it didn't work.
I got a classNotFoundException.

the two progrma is fairly simple. I don't know what is wrong.


tomcat 5.0
Win xp
JSDK 1.4
SQL server 2000
JDBC for SQL server 2000

thanks!
chijingaoAsked:
Who is Participating?
 
Nick_72Connect With a Mentor Commented:
But please remember to hit the 'Accept' button ;)
0
 
Nick_72Commented:
which class is it not able to find?

try adding this to the top of your jsp page:

<%@ page import="java.sql.*"%>

/Nick
0
 
chijingaoAuthor Commented:
Class.forName(
                                "com.microsoft.jdbc.sqlserver.SQLServerDriver");

is wrong!
0
Cloud Class® Course: Amazon Web Services - Basic

Are you thinking about creating an Amazon Web Services account for your business? Not sure where to start? In this course you’ll get an overview of the history of AWS and take a tour of their user interface.

 
Nick_72Commented:
Please post the whole error message you get when it shows ClassNotFoundException.
0
 
Nick_72Commented:
oh ok...

then you'll need to put the zip file with the MS SQL server jdbc driver in the webapps /lib folder
0
 
Nick_72Commented:
{Tomcat home}\webapps\yourwebapp\WEB-INF\lib
0
 
Nick_72Commented:
then restart Tomcat
0
 
chijingaoAuthor Commented:
i don't have a zip file. I have a setup.exe!
 
0
 
Nick_72Commented:
ok, but when you run the setup.exe, you will install it to some place on the disc, then take the 3 zip files from the lib folder of that installation and copy them to your webapp's lib folder.

The path could look something like this:

C:\Program Files\Microsoft SQL Server 2000 Driver for JDBC\lib
0
 
chijingaoAuthor Commented:
I have done it before i came here :(
0
 
Nick_72Commented:
did you copy them to you webapps lib folder under tomcat??
0
 
chijingaoAuthor Commented:
o wait I am new..

what is {Tomcat home}\webapps\yourwebapp\WEB-INF\lib  ??

I just put all my files under {Tomcat home}\webapps\Root\
0
 
Nick_72Commented:
alright then, copy the zip files to

{Tomcat home}\webapps\Root\WEB-INF\lib
0
 
chijingaoAuthor Commented:
I have three *.jar files under C:\Program Files\Microsoft SQL Server 2000 Driver for JDBC\lib

I copied them to C:\Program Files\Apache Software Foundation\Tomcat 5.0\common\lib
0
 
chijingaoAuthor Commented:
o. I copied it now {Tomcat home}\webapps\Root\WEB-INF\lib.


let me try it..
0
 
Nick_72Commented:
remember to restart tomcat first :)
0
 
chijingaoAuthor Commented:
it works well!!!!!!!!!

thanks a lot.
It is the first time I come here.

thanks a lot agian.
0
 
Nick_72Commented:
No problem :)
0
 
chijingaoAuthor Commented:
note: it didn't work again two days later. Sql 2000 server patch 3 is also needed. i installed it and now every thing is OK.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.