This week's book giveaway is in the Mac OS forum. We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line! See this thread for details.
The "type" is the classname of the DataSource class that will be instantiated by Tomcat when the resource is created. One is the generic DataSource, one is an Oracle-specific one, and if you'll notice, there's also a factory classname given for that one, meaning that Tomcat will use the factory instead of simply constructing the Oracle DataSource using "newInstance()".
WebSphere also has one or 2 vendor-specific datasource classes, and I'm sure that there a quite a few others out there as well. The ability to specify a custom DataSource type allows you to take advantage of DataSources whose capabilities maximize vendor-specific advantages of a particular DBMS. In particular, you might expect to find both XA and non-XA type datasources available.
Customer surveys are for companies who didn't pay proper attention to begin with.
Joined: Jun 11, 2007
Thank You Tim for the answer. by the way if you mind can you specify what steps actually need to configure tomcat successfully with JNDI. I have try several ways but end up with "Cannot get connection: javax.naming.NameNotFoundException: Name xyz is not bound in this Context"
I have found tomcat web site article bit complex and more steps than this article. I hope the latter article also correct right..but it didnt work..but i think that article didnt explain it with eclipse because it says "Add the below webapps/jdbc/META-INF/context.xml file" where i dont find a context.xml file under WebContent/META-INF in eclipse project file structure. can you please answer.
Another reason why we're not real excited when people use an IDE to build their projects. An IDE can be a big assist, but it's no substitute for actually knowing what's going on.
Every deployed Tomcat webapp has a context. The context defines the base URL for the app, where to find the application's codebase, and additional defined resources, if/as needed, including the Connection Pool (DataSource) definition. If you don't explictly define a context, one will be created for any WAR found in the TOMCAT_HOME/webapps directory, where the context name will be "warname" and the codeBase will be "TOMCAT_HOME/webapps/warname" or "TOMCAT_HOME/webapps/warname.war", depending on whether or not the WAR is exploded.
You can define a context yourself and put it in one of 3 places.
1. As a file named "context.xml" in the META-INF directory of your WAR.
2. As a file whose extension is ".xml" in the TOMCAT_HOME/conf/Catalina/localhost directory (will override #1).
3. As an XML entry in the TOMCAT_HOME/conf/server.xml file (But please don't do this!).
The full documentation on the format of the Context element and its children is on the Tomcat documentation site. Your DataSource definition would be one of those children.
Joined: Jun 11, 2007
Thank Tim..i have successfuly did it..
one question please..now what i did was adding <Resource> in context.xml in tomcat (under eclipse) and add <resource-ref> for web..xml in my project....But is there a way to do all settings in server not in project web.xml..i mean the <resource-ref>.. i know its stupid question but there is a project that existing code should not touch..so try to minimize the changes in web.xml..you got the point sir..