This week's book giveaway is in the Design forum.
We're giving away four copies of Design for the Mind and have Victor S. Yocco on-line!
See this thread for details.
Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

tomcat and db connectivity

 
salil misra
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hello,this is salil misra

this has become a big headache for me ...
i am trying to develop my project and trying to get db connectivity

i am using following :

1) tomcat 5
2) my sql db

i want to know :

1) i want to use a type 4 jdbc driver
2) for db connectivity what all to configure in the web.xml file


this is a request i have ben stuck on this for many days now please do provide answers to my questions its very much important for me
 
Sachin Joshi
Ranch Hand
Posts: 83
Java Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You need to download MySQL driver jar file from

MySQL Connector

Keep this jar in your tomcat -> webapps/<YourApp>/WEB-INF/lib directory.

And use JDBC API to connect to MySQL.

Make sure your MySQL database is up up and running.

You can find some Example code about how to connect using JDBC thin driver
[ August 26, 2008: Message edited by: Sachin Joshi ]
 
Kalyan Ram
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Salil, if you do as the Sachin says you don't have to configure anything in the web.xml.

OTOH, if you want to configure MySQL as JNDI resource then check Tomcat's documentation or click here -> mysql datasource in tomcat

regards
Kalyan
[ August 26, 2008: Message edited by: Kalyan Ram ]
 
Harmandeep Singh
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nothing is to be done in the web.xml file.
Connectivity coding is to be written in java class.

It as below:




I hope it will help you.

With regards
From
Harmandeep Singh
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic