Advertisement

02.16.2005 at 12:27PM PST, ID: 21317510
[x]
Attachment Details

Tomcat - Data Source - Driver Issue

Asked by amacfarl in Java Server Pages (JSP)

Tags: tomcat, driver, jdbc

Folks,

I am trying to connect to a MS SQL database using Tomcat/JSP but having issues.  The code that I am using is as follows:

      Context ic = new InitialContext();
      DataSource ds = (DataSource) ic.lookup("java:comp/env/jdbc/test");
      Connection conn = ds.getConnection();
      Statement stmt = conn.createStatement();

I have added the following code to my Server.xml:

       <Resource name="jdbc/test" auth="Container" type="javax.sql.DataSource"
               maxActive="100" maxIdle="30" maxWait="10000"
               username="DB_AW_DATA" password="tester" driverClassName="com.microsoft.jdbc.sqlserver.SQLServerDriver"
               url="jdbc:microsoft:sqlserver://192.168.0.1\\Newcastle"/>

And I have added the following code to web.xml:

<resource-ref>
  <description>
    Resource reference to java.sql.Connection
    factory defined in server.xml
  </description>
  <res-ref-name>jdbc/test</res-ref-name>
  <res-type>javax.sql.DataSource</res-type>
  <res-auth>Container</res-auth>
</resource-ref>

The error message that I am getting is as follows:

java.sql.SQLException: Cannot load JDBC driver class 'null'

What confuses me is that I have placed the following files in Tomcat\common\lib...

mssqlserver.jar
msbase.jar
msutil.jar

However they are also included in Tomcat\webapps\-AppName-\WEB-INF\lib as they are included in th *.war file.

What is also confusing is that when deploying the *.war file I get the following

Tomcat\webapps\-AppName-\classes
Tomcat\webapps\-AppName-\classes(2)
Tomcat\webapps\-AppName-\Tomcat\conf
Tomcat\webapps\-AppName-\Tomcat\conf(2)

Please help.  Any help would be much apprecaited.

Kind regards
Angus



Start Free Trial
[+][-]02.16.2005 at 12:53PM PST, ID: 13328681

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]02.16.2005 at 12:57PM PST, ID: 13328721

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]02.16.2005 at 01:34PM PST, ID: 13329112

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]02.16.2005 at 04:12PM PST, ID: 13330405

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]02.16.2005 at 04:45PM PST, ID: 13330581

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]02.17.2005 at 03:26AM PST, ID: 13333493

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]02.17.2005 at 04:39AM PST, ID: 13333958

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]02.17.2005 at 04:54AM PST, ID: 13334065

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]02.17.2005 at 04:58AM PST, ID: 13334103

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]02.17.2005 at 04:59AM PST, ID: 13334109

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]02.17.2005 at 05:06AM PST, ID: 13334157

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: Java Server Pages (JSP)
Tags: tomcat, driver, jdbc
Sign Up Now!
Solution Provided By: TimYates
Participating Experts: 3
Solution Grade: A
 
 
[+][-]02.17.2005 at 05:13AM PST, ID: 13334207

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]02.17.2005 at 05:21AM PST, ID: 13334264

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]02.17.2005 at 05:22AM PST, ID: 13334272

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32