Forums Register Login

How i can connect my servlet to mysql database

+Pie Number of slices to send: Send
Hi,
Will anybody please tell me how i can connect my servlet to mysql database.
i am using jdk1.5,tomcat5 & mysql4.0.18.The installation directory for thes are as:
C:\Program Files\Java\jdk1.5.0_12
C:\Tomcat5.0
C:\mysql\
I am putting all my servlet file inside testpackage,package so the folder sequence is like :
C:\Tomcat5.0\webapps\servlets-examples\WEB-INF\classes\testpackage
i have created student database and it is in C:\mysql\data directory
this database contains a simple table name detail with column like roll,name,address.
Now i want to connect this table with servlet and want to display the data from this table to my browser.
Please tell me where i should place the database,what change i should make in web.xma(if it is required).
For example say if i want to connect displatRecord servlet(means diplayRecord.java, this will be inside testpackage, package) to detail table and want to display the records in browser then what should i do.
I know java connectivity with access database but i do not knoe how this can be done with servlet when i am using a local server.
Thanks to all
Rashmi
+Pie Number of slices to send: Send
You dont connect servlet to database but use jdbc for database access.
Look at this tutorial Servlet tutorial
+Pie Number of slices to send: Send
This page shows how to set up Tomcat's internal database connection pool.
Look! It's Leonardo da Vinci! And he brought a tiny ad!
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 6366 times.
Similar Threads
shoot me but answe this question
servlet jdbc
using external jar files
How to use Jboss
Problem in send redirect
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 18:22:38.