There's a lot of information to work with, and not all of it will fit into a single post; however, I will try to get you started in the right direction. I may be a few versions of Tomcat behind, but it sounds like this project may be, also, so this information shouldn't be too out of date.
(I also apologize for not giving you any direct code or configuration--I don't have a setup to play with at the moment, so this will be mostly "hand waving" advice.)
You have three configuration requirements here, and it sounds like two of them are (fairly) complete. Server credentials and access, driver "correctness", and Tomcat config.
You said you successfully pinged the SQL Server using Eclipse, so driver, credentials, and network access are confirmed. That just leaves the Tomcat config.
Tomcat (and the servlets) are set up (mostly) by xml config files, which you already seem to be familiar with. There is the server.xml, which controls the high-level stuff, and then there are what are named "Context" configurations--basically, subdivisions of the server for different sites, applications, subdirectories, etc. These context files provide things like access controls, renaming, and, in your case, common resources like database connections
. The connectivity info doesn't have
to be in the context files, but it's best practice to do so because you can swap around database connections in one go instead of hitting umpteen different web apps or hundreds of servlets.
If you have access to the server, you can change these files, since they are just text files. If you take the time to learn the Tomcat admin interface (and it's installed and accessible) you can also make the changes there.
I keep saying "context.xml files" (plural) because there are context files for individual applications, and there is one big mama for the entire server. If you want this connection available to all applications, you put the configuration entry in the big Context.xml file for the server. Here's a good writeup on how, and where, context.xml files are located
, and what scope they have on the system.
From the sound of it, you are either trying to add a new SQL server connection, or replace the Oracle connection. Either way, you will be changing the entry (or adding an entry) in one of the context.xml files.
Since you have Eclipse, I would recommend the following to get everything set up.
- Read the configuration links I've provided. Those will take you to a few other concepts that you may need to understand, but keep everything focused on "configure sqljdbc in Tomcat"
- Create a simple servlet app (say, a page that does a very specific record count from your database server.)
- Keep testing the servlet until you can get it running in the IDE
- Look at the context.xml and resource config that works. Then, when you've read through the Tomcat JNDI config instructions enough, either add or replace the resource config in the appropriate context.xml
- Install your test app to see if it works.
I apologize for this sounding like an "RTFM" response. There really is a lot to consider, but you should be able to do it by following the appropriate cook book--it's just digging out the correct recipe.
Let me know how it goes, and I'll try to help with any specific problems you run into. Meanwhile, I'll probably start my own setup to see how it runs (and knock the rust off the skillset).
Stack Overflow with a specific configuration for the driver
Configure SQL Server connection pool on Tomcat
MS pages on their JDBC configuration
All JDBC parameters
Client trust store setup
One example of troubleshooting