chijingao
asked on
*.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!
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!
ASKER
Class.forName(
"com.microsoft.jdbc.sqlser ver.SQLSer verDriver" );
is wrong!
"com.microsoft.jdbc.sqlser
is wrong!
Please post the whole error message you get when it shows ClassNotFoundException.
oh ok...
then you'll need to put the zip file with the MS SQL server jdbc driver in the webapps /lib folder
then you'll need to put the zip file with the MS SQL server jdbc driver in the webapps /lib folder
{Tomcat home}\webapps\yourwebapp\W EB-INF\lib
then restart Tomcat
ASKER
i don't have a zip file. I have a setup.exe!
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
The path could look something like this:
C:\Program Files\Microsoft SQL Server 2000 Driver for JDBC\lib
ASKER
I have done it before i came here :(
did you copy them to you webapps lib folder under tomcat??
ASKER
o wait I am new..
what is {Tomcat home}\webapps\yourwebapp\W EB-INF\lib ??
I just put all my files under {Tomcat home}\webapps\Root\
what is {Tomcat home}\webapps\yourwebapp\W
I just put all my files under {Tomcat home}\webapps\Root\
alright then, copy the zip files to
{Tomcat home}\webapps\Root\WEB-INF \lib
{Tomcat home}\webapps\Root\WEB-INF
ASKER
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
I copied them to C:\Program Files\Apache Software Foundation\Tomcat 5.0\common\lib
ASKER
o. I copied it now {Tomcat home}\webapps\Root\WEB-INF \lib.
let me try it..
let me try it..
remember to restart tomcat first :)
ASKER
it works well!!!!!!!!!
thanks a lot.
It is the first time I come here.
thanks a lot agian.
thanks a lot.
It is the first time I come here.
thanks a lot agian.
No problem :)
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
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.
try adding this to the top of your jsp page:
<%@ page import="java.sql.*"%>
/Nick