Solved

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

Posted on 2004-04-20
19
317 Views
Last Modified: 2010-04-01
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!
0
Comment
Question by:chijingao
  • 11
  • 8
19 Comments
 
LVL 9

Expert Comment

by:Nick_72
ID: 10869282
which class is it not able to find?

try adding this to the top of your jsp page:

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

/Nick
0
 

Author Comment

by:chijingao
ID: 10869303
Class.forName(
                                "com.microsoft.jdbc.sqlserver.SQLServerDriver");

is wrong!
0
 
LVL 9

Expert Comment

by:Nick_72
ID: 10869310
Please post the whole error message you get when it shows ClassNotFoundException.
0
Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

 
LVL 9

Expert Comment

by:Nick_72
ID: 10869315
oh ok...

then you'll need to put the zip file with the MS SQL server jdbc driver in the webapps /lib folder
0
 
LVL 9

Expert Comment

by:Nick_72
ID: 10869340
{Tomcat home}\webapps\yourwebapp\WEB-INF\lib
0
 
LVL 9

Expert Comment

by:Nick_72
ID: 10869345
then restart Tomcat
0
 

Author Comment

by:chijingao
ID: 10869354
i don't have a zip file. I have a setup.exe!
 
0
 
LVL 9

Expert Comment

by:Nick_72
ID: 10869383
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
 

Author Comment

by:chijingao
ID: 10869395
I have done it before i came here :(
0
 
LVL 9

Expert Comment

by:Nick_72
ID: 10869423
did you copy them to you webapps lib folder under tomcat??
0
 

Author Comment

by:chijingao
ID: 10869424
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
 
LVL 9

Expert Comment

by:Nick_72
ID: 10869435
alright then, copy the zip files to

{Tomcat home}\webapps\Root\WEB-INF\lib
0
 

Author Comment

by:chijingao
ID: 10869439
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
 

Author Comment

by:chijingao
ID: 10869450
o. I copied it now {Tomcat home}\webapps\Root\WEB-INF\lib.


let me try it..
0
 
LVL 9

Expert Comment

by:Nick_72
ID: 10869468
remember to restart tomcat first :)
0
 

Author Comment

by:chijingao
ID: 10869471
it works well!!!!!!!!!

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

thanks a lot agian.
0
 
LVL 9

Expert Comment

by:Nick_72
ID: 10869505
No problem :)
0
 
LVL 9

Accepted Solution

by:
Nick_72 earned 125 total points
ID: 10869537
But please remember to hit the 'Accept' button ;)
0
 

Author Comment

by:chijingao
ID: 10943006
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

Featured Post

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

How to get Spreadsheet Compare 2016 working with the 64 bit version of Office 2016
Smart phones, smart watches, Bluetooth-connected devices—the IoT is all around us. In this article, we take a look at the security implications of our highly connected world.
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

820 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question