File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Tomcat and the fly likes tomcat and db connectivity Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Products » Tomcat
Bookmark "tomcat and db connectivity" Watch "tomcat and db connectivity" New topic
Author

tomcat and db connectivity

salil misra
Greenhorn

Joined: Jun 24, 2008
Posts: 5
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

Joined: Aug 06, 2008
Posts: 83

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 ]

Web Development Tips and Tutorials - By Sachin
Kalyan Ram
Greenhorn

Joined: Dec 29, 2003
Posts: 14
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

Joined: Aug 18, 2008
Posts: 5
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: tomcat and db connectivity