Solved

JSP, Tomcat web.xml file for connection to a SQL Server 2000 Database.

Posted on 2004-09-24
1
1,662 Views
Last Modified: 2010-05-18
Hi I have an issue with a web application that is currently running on Tomcat Server 5.0.27. I have this web.xml file that connects to the database and I need the proper syntax to add to the web.xml page.  This could be a question for SQL Server 2000, as well.
I have the 3 .jar files for the JDBC driver from Microsoft (msbase.jar, mssqlserver.jar, msutil.jar) and I had this connection working previously, but I lost the syntax somehow working back and fourth with Access and SQL.  
I have my JSP, and Servlets correctly put together, but I need the web.xml file to list the driver, name of the database, username, password, etc.  If someone knows the answer, please make sure it fits into this code from my web.xml file.  The name of the database is "Data9000SQL" that sits on MS SQL Server 2000. Again, I have all 3 .jar files, they are in the correct path, and I just need to change it from the access, which i have now, to the MS SQL Server 2000.

Here is my web.xml file code...................... I need to incorporate MS SQL Server 2k, instead of access which i already have.....

<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
  <!-- JSPC servlet mappings start -->
  <servlet>
    <servlet-name>bah.arl.evaluations.servlet.SubmitServlet</servlet-name>
    <servlet-class>bah.arl.evaluations.servlet.SubmitServlet</servlet-class>
  </servlet>
  <servlet-mapping>
    <servlet-name>bah.arl.evaluations.servlet.SubmitServlet</servlet-name>
    <url-pattern>/evaluations.jsp</url-pattern>
  </servlet-mapping>

 <servlet>
    <servlet-name>bah.arl.evaluations.servlet.ResultServlet</servlet-name>
    <servlet-class>bah.arl.evaluations.servlet.ResultServlet</servlet-class>
  </servlet>
 <servlet-mapping>
    <servlet-name>bah.arl.evaluations.servlet.ResultServlet</servlet-name>
    <url-pattern>/results.jsp</url-pattern>
  </servlet-mapping>



  <description>


     Welcome to Evaluations
  </description>
  <display-name>Welcome to Evaluations</display-name>
  <!-- JSPC servlet mappings start -->
  <context-param>
    <param-name>abc</param-name>
    <param-value>sun.jdbc.odbc.JdbcOdbcDriver</param-value>
  </context-param>
  <context-param>
    <param-name>dbName</param-name>
    <param-value>jdbc:odbc:Driver={Microsoft Access Driver (*.mdb)};DBQ=C:\\projects\\evaluations\\db\\Data9000_Access</param-value>
  </context-param>
  <!-- JSPC servlet mappings end -->

</web-app>
0
Comment
Question by:apapanic
1 Comment
 
LVL 1

Accepted Solution

by:
matthew_york earned 500 total points
ID: 12158628
Hi there, I've got a similar setup that i have configured along these lines, hope this helps:

// Tomcat  - server.xml

<Context docBase="App" path="/App" reloadable="true">
      <Resource auth="Container" name="jdbc/test" type="javax.sql.DataSource"/>
      <ResourceParams name="jdbc/test">
            <parameter>
                  <name>driverClassName</name>
                  <value>com.microsoft.jdbc.sqlserver.SQLServerDriver</value>
            </parameter>
            <parameter>
                  <name>url</name>
                  <value>jdbc:microsoft:sqlserver://locahost:1433</value>
            </parameter>
            <parameter>
                  <name>username</name>
                  <value>abc</value>
            </parameter>
            <parameter>
                  <name>password</name>
                  <value>def</value>
            </parameter>
            <parameter>
                  <name>databaseName</name>
                  <value>Data9000SQL</value>
            </parameter>
            <parameter>
                  <name>maxActive</name>
                  <value>100</value>
                  </parameter>
            <parameter>
                  <name>maxIdle</name>
                  <value>50</value>
            </parameter>
            <parameter>
                  <name>removeAbandoned</name>
                  <value>true</value>
            </parameter>
      </ResourceParams>
</Context>

// App - Application web.xml

<resource-ref>
      <res-ref-name>jdbc/test</res-ref-name>
      <res-type>javax.activation.DataSource</res-type>
      <res-auth>Container</res-auth>
      <res-sharing-scope>Shareable</res-sharing-scope>
</resource-ref>
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
change size of out.write buffer 1 87
library class in java 1 90
issue with pdf generation 2 85
HTTPSessionBindingListernter not configured in deployment descriptor 2 40
In 2017, ransomware will become so virulent and widespread that if you aren’t a victim yourself, you will know someone who is.
Knowledge base software has turned out to be a quite reliable method for storing information, promoting collaborative work and for sharing valuable input and solutions.However, some organizations are trying to develop a knowledge base that works wit…
Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, just open a new email message. In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…

863 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

Need Help in Real-Time?

Connect with top rated Experts

25 Experts available now in Live!

Get 1:1 Help Now