• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Paul Clapham
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Roland Mueller
  • Piet Souris
Bartenders:

tomcat and db connectivity

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 83
Spring Tomcat Server Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
reply
    Bookmark Topic Watch Topic
  • New Topic