Skip to main content link. Accesskey S
  • Help
  • IBM Logo
  • IBM Web Experience Factory wiki
  • All Wikis
  • All Forums
  • ANNOUNCEMENT: Wiki changed to read-only. READ MORE...
  • Home
  • Product Documentation
  • Community Articles
  • Learning Center
  • IBM Redbooks
  • API Documentation
Search
Community Articles > FAQs > How can I create a JDBC Data Source on Tomcat?
  • Share Show Menu▼
  • Subscribe Show Menu▼

About the Original Author

Click to view profileRob Flynn
Contribution Summary:
  • Articles authored: 199
  • Articles edited: 253
  • Comments Posted: 2

Recent articles by this author

JAX-WS Handler Sample using IBM Web Experience Factory

Overview The Web Experience Factory (WEF) 8.0 release contains an enhancement to the web service call builders that gives you an option to define a global JAXWS handler class. This handler makes it possible for models to intercept and process the inbound and outbound SOAP envelopes ...

WebSphere Dashboard Framework 7.0.1.1 Fix pack now available

The WebSphere Dashboard Framework 7.0.1.1 Fix pack has been released.

IBM Web Experience Factory Version 7.0.1.4 Fix Pack is now available

This fix pack includes new fixes and updates for Web Experience Factory Version 7.0.1. and is now available on Fix Central and can be downloaded from here: ...

IBM Web Experience Factory WCAG 2.0 Compliance

IBM Web Experience Factory, developed and tested compliant to WCAG 2.0, can produce output ( web pages , sites and content) that can be WCAG 2.0 Level A and Level AA compliant. IBM Web Experience Factory neither enforces nor prevents this compliance. Application developers must know and understand ...

Yeah!!! New IBM Web Experience Factory V8.0 is announced!!!

A quick snapshot of what's new in IBM Web Experience Factory... IBM Web Experience Factory is all about making it quick and easy to develop applications (portlets) that are included as part of an exceptional web experience. We've seen our customers doing some awesome stuff, whether it be ...
Community articleHow can I create a JDBC Data Source on Tomcat?
Added by Rob Flynn | Edited by IBM contributorGeorge Fairbairn on April 24, 2012 | Version 10
expanded Abstract
collapsed Abstract
No abstract provided.
Tags: data access faq, faq, Tomcat, JDBC

Here are the steps for creating a Data Source on Tomcat:

  1. In Tomcat's context.xml file (/conf/context.xml), add a line similar to the following:

    <ResourceLink global="jdbc/MY_DATA_SOURCE_NAME" name="jdbc/MY_DATA_SOURCE_NAME" type="javax.sql.DataSource"/> 


  2. In Tomcat's server.xml file (/conf/server.xml, add the following XML snippet to the node:

    <Resource name="jdbc/MY_DATA_SOURCE_NAME"
    
    
    		type="javax.sql.DataSource"
    
    
    		password="welcome"
    
    
    		driverClassName="com.ibm.db2.jcc.DB2Driver"
    
    
    		maxIdle="2" maxWait="5000"
    
    
    		validationQuery="select * from qauser.employee"
    
    
    		username="qauser"
    
    
    		url="jdbc:db2://qadb2v8:50000/QADATA"
    
    
    		maxActive="4" /> 


  3. In Tomcat's common/lib directory, add the JDBC driver JARs (for DB2 v8.x or 9.x, these are db2jcc.jar, db2jcc_license_cu.jar, and
    db2jcc_license_cisuz.jar). If connecting to DB2 v7, use the db2java.jar driver instead.
      You actually only need one of those license JARs. The "cu" JAR is for windows, the "cisuz" JAR is for UNIX, etc.

  4. In your project's WebContent\WEB-INF\bin\deployment find the standalone.web.xml and edit it.  Add the following xml just before the closing tag:

<resource-ref>

	 <description>DB2 example</description>

	 <res-ref-name>jdbc/SAMPLEShared</res-ref-name>

	 <res-type>javax.sql.DataSource</res-type>

	 <res-auth>Container</res-auth>

	</resource-ref>

 

expanded Attachments (0)
collapsed Attachments (0)
expanded Versions (10)
collapsed Versions (10)
Version Comparison     
VersionDateChanged by              Summary of changes
11Apr 24, 2012, 3:59:26 PMGeorge Fairbairn  IBM contributor
This version (10)Apr 24, 2012, 3:58:52 PMGeorge Fairbairn  IBM contributor
9Apr 24, 2012, 3:58:04 PMGeorge Fairbairn  IBM contributor
8Dec 23, 2009, 9:58:25 AMRob Flynn  IBM contributor
7Dec 23, 2009, 9:57:23 AMRob Flynn  IBM contributor
6Oct 30, 2008, 12:46:58 PMDeAnna Steiner  IBM contributor
5Aug 7, 2008, 11:18:46 AMRob Flynn  IBM contributor
4Aug 7, 2008, 11:12:57 AMRob Flynn  IBM contributor
3Aug 7, 2008, 11:11:24 AMRob Flynn  IBM contributor
1Aug 7, 2008, 10:05:02 AMRob Flynn  IBM contributor
Copy and paste this wiki markup to link to this article from another article in this wiki.
Go ElsewhereStay ConnectedHelpAbout
  • IBM Collaboration Solutions wikis
  • IBM developerWorks
  • IBM Software support
  • Twitter LinkIBMSocialBizUX on Twitter
  • BlogsIBMSocialBizUX on Facebook
  • ForumsLotus product forums
  • BlogsIBM Social Business UX blog
  • Community LinkThe Social Lounge
  • Wiki Help
  • Forgot user name/password
  • Wiki design feedback
  • Content feedback
  • About the wiki
  • About IBM
  • Privacy
  • Accessibility
  • IBM Terms of use
  • Wiki terms of use