I am new to Tomcat and Java SE 6 and need to know what I need to do to install, configure and use the Microsoft JDBC driver.
I have download the JDBC driver and extracted it to a directory on a windows 2008 system. I am going to install a couple of Java applications into tomcat 6 that need to talk to a SQL database.
Do I need to copy files from the JDBC directory to the tomcat directories or the java application directories installed in tomcat?
Do I need to configure any anything anything else?
As the links that Gagandeep provided will say, in order for your JVM to make a database connection, the JDBC driver jar(s) have to be on the classpath, and you’ll need to provide your Java program with an appropriate connection string and credentials.
As far as what you need to do specifically with Tomcat, that depends quite a bit on your applications and how they retrieve a connection to the datab
Now there are a few options as far creating and providing this connection. With Tomcat and Java EE applications, your Java application could define a in its web.xml. Tomcat would be responsible for creating/maintaining the connection (pool) and providing it to the application as needed. In this case the driver would have to be on Tomcat’s classpath, you’d need some configuration in your application’s corresponding context.xml and possibly even the server.xml. Here’s some Tomcat docs on this method topic
Alternatively, your application could be responsible itself for setting up and tearing down the database connections, in which case the driver jars probably belong in the WAR / part of the WAR’s classpath. Then all that is needed is a method for getting the required connection information into the application (environment entries, property files, any number of other methods)…