Setup SQL server 2000 with Tomcat 5.x

Hello,

I am trying to setup a SQL server 2000 with tomcat 5.x to run a  webapp. Can anyone please tell me how to configure my server.xml, we.xml and installing SQL drivers in \lib folder of Tomcat.
I would love to have a straight forward xml snippet with directions and I will follow up on this thread if I have more doubts.

thanks,
Kanishk.
kanishkpanwarAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

KuldeepchaturvediCommented:
instead of server.xml. you should be creating a context file in conf /catalina/localhost it will look something like this

<Context path="/ACProspero" docBase="C:/Tomcat5.0/webapps/ACProspero" debug="0" reloadable="true" crossContext="true">
  <Resource name="jdbc/SQLServerSuppData" auth="Container" type="com.microsoft.jdbcx.sqlserver.SQLServerDataSource" />
 <ResourceParams name="jdbc/SQLServerSuppData">
 <parameter>
  <name>user</name>
  <value>sa</value>
  </parameter>
 <parameter>
  <name>password</name>
  <value>password</value>
  </parameter>
 <parameter>
  <name>serverName</name>
  <value>machinename</value>
  </parameter>
 <parameter>
  <name>port</name>
  <value>1433</value>
  </parameter>
 <parameter>
  <name>driverClassName</name>
  <value>com.microsoft.jdbcx.sqlserver.SQLServerDataSource</value>
  </parameter>
 <parameter>
  <name>driverName</name>
  <value>SQLServer</value>
  </parameter>
 <parameter>
  <name>factory</name>
  <value>com.microsoft.jdbcx.sqlserver.SQLServerDataSourceFactory</value>
  </parameter>
 <parameter>
  <name>DatabaseName</name>
  <value>AC_DEV</value>
  </parameter>
 <parameter>
  <name>url</name>
  <value>jdbc:microsoft:sqlserver</value>
  </parameter>
 <parameter>
  <name>maxActive</name>
  <value>2</value>
  </parameter>
 <parameter>
  <name>maxIdle</name>
  <value>1</value>
  </parameter>
  </ResourceParams>


after this you will have to add following in  web.xml
<resource-ref>
        <description>DataSource</description>        
        <res-ref-name>jdbc/SQLServerSuppData</res-ref-name>
             <res-type>com.microsoft.jdbcx.sqlserver.SQLServerDataSource</res-type>        
        <res-auth>Container</res-auth>
    </resource-ref>

and you shd keep following jar file in your tomcat/lib
msutil.jar
msbase.jar
msssqlserver.jar
kanishkpanwarAuthor Commented:
" instead of server.xml. you should be creating a context file in conf /catalina/localhost it will look something like this"
-- why is that?

Resource name="jdbc/SQLServerSuppData"....
what is this? Name of the Database or just a unique name given for JNDI lookup?
kanishkpanwarAuthor Commented:
also,
Can you please post links to download the mentioned 3 jar files ?

thanks.
Become a CompTIA Certified Healthcare IT Tech

This course will help prep you to earn the CompTIA Healthcare IT Technician certification showing that you have the knowledge and skills needed to succeed in installing, managing, and troubleshooting IT systems in medical and clinical settings.

KuldeepchaturvediCommented:
>>instead of server.xml. you should
because in tomcat 5.x you can create a separate file for each context. It helps maintaining them better the resource name is the unique name for your JNDI look up
database name goes in the parameters

as far as downloading these jars are concerned you can download them from microsoft... just google the name & it will give you the link..
Siva Prasanna KumarPrincipal Solutions ArchitectCommented:
http://tomcat.apache.org/tomcat-5.5-doc/jndi-datasource-examples-howto.html

check out the MySql configuration and make the changes to server.xml like server name , username & pass word.


it will be like

server.xml
------------
   
 <Context path="/DBTest" docBase="DBTest"
        debug="5" reloadable="true" crossContext="true">

  <Resource name="jdbc/TestDB" auth="Container" type="com.microsoft.jdbcx.sqlserver.SQLServerDataSource"
               maxActive="100" maxIdle="30" maxWait="10000"
               username="yourUsername" password="yourPassword" driverClassName="com.microsoft.jdbcx.sqlserver.SQLServerDataSource"
               url="jdbc:microsoft:sqlserver://localhost:1433/databaseName"/>

</Context>

web.xml
----------

   
 <web-app 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"
    version="2.4">
  <description>SQL Server Test App</description>
  <resource-ref>
      <description>DB Connection</description>
      <res-ref-name>jdbc/TestDB</res-ref-name>
      <res-type>com.microsoft.jdbcx.sqlserver.SQLServerDataSource</res-type>
      <res-auth>Container</res-auth>
  </resource-ref>
</web-app>

 and you get the required Jars at.

http://www.microsoft.com/downloads/details.aspx?FamilyID=4f8f2f01-1ed7-4c4d-8f7b-3d47969e66ae&displaylang=en

and for reference just check out

http://www.akadia.com/services/sqlsrv_jdbc.html.

Thank You.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
kanishkpanwarAuthor Commented:
Hello,
Just to let you know..I have not forgotten about this thread. I am a bit busy with some other work. I'll respond in a day or 2. I am sorry for the trouble.
kanishkpanwarAuthor Commented:
my system has crashed. I am arranging for a new copy of SQL SERVER. Please bear with me. thank you.
kanishkpanwarAuthor Commented:
btw, I want to use j_security_check mechanism to login.
Can anyone tell me SQL server settings with respect to that?
kanishkpanwarAuthor Commented:
Sadly, none of the experts answered the question I had asked. but still..I awarded points to one of the experts.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
JSP

From novice to tech pro — start learning today.