Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2004-04-20
19
Medium Priority
?
326 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
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 500 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

When trying to connect from SSMS v17.x to a SQL Server Integration Services 2016 instance or previous version, you get the error “Connecting to the Integration Services service on the computer failed with the following error: 'The specified service …
Considering cloud tradeoffs and determining the right mix for your organization.
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…

730 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