Configure Tomcat's Data Source for Eclipse

1. Environment:

Windows 7 64bit, Eclipse Juno, Tomcat 7.

2. Configuration:

The most important thing is knowing where to configure: In Eclipse's project explorer, we can see Servers -> Tomcat v7.0 Server at localhost-config, what we need to configure is the server.xml and context.xml. The rest of configuration is no different with common Tomcat configuration, which you can refer to this post:http://stackoverflow.com/questions/9183321/how-to-use-jndi-datasource-provided-by-tomcat-in-spring

Note that following part in context.xml:

<ResourceLink name="jdbc/DatabaseName"
   global="jdbc/DatabaseName"
   type="javax.sql.DataSource"/>
Alternative: access and configure the server.xml and context.xml via file system rather than Eclipse, you can get it by this address by default: $eclipse_workspace$\Servers\Tomcat v7.0 Server at localhost-config

3. Caveat:

Don't try to configure the local Tomcat installation directory's file for Eclipse;

Don't try to configure the file under $eclipse_workspace$\.metadata\.plugins\org.eclipse.wst.server.core\tmp0.


你可能感兴趣的:(Configure Tomcat's Data Source for Eclipse)