<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Codeseeker's Weblog &#187; Oracle</title>
	<atom:link href="http://codeseeker.wordpress.com/tag/oracle/feed/" rel="self" type="application/rss+xml" />
	<link>http://codeseeker.wordpress.com</link>
	<description>Just another WordPress.com weblog</description>
	<lastBuildDate>Sun, 21 Sep 2008 16:23:33 +0000</lastBuildDate>
	<generator>http://wordpress.com/</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<cloud domain='codeseeker.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://www.gravatar.com/blavatar/fd53d4792e3f89e6bb9a243ba36669bb?s=96&#038;d=http://s.wordpress.com/i/buttonw-com.png</url>
		<title>Codeseeker's Weblog &#187; Oracle</title>
		<link>http://codeseeker.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://codeseeker.wordpress.com/osd.xml" title="Codeseeker&#8217;s Weblog" />
		<item>
		<title>Eclipse + Tomcat 5.5 + JDBC + Oracle 9</title>
		<link>http://codeseeker.wordpress.com/2008/06/26/eclipse-tomcat-55-jdbc-oracle-9/</link>
		<comments>http://codeseeker.wordpress.com/2008/06/26/eclipse-tomcat-55-jdbc-oracle-9/#comments</comments>
		<pubDate>Thu, 26 Jun 2008 09:02:22 +0000</pubDate>
		<dc:creator>codeseeker</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Eclipse]]></category>
		<category><![CDATA[Howto]]></category>
		<category><![CDATA[J2EE]]></category>
		<category><![CDATA[JDBC]]></category>
		<category><![CDATA[Oracle]]></category>
		<category><![CDATA[Tomcat]]></category>

		<guid isPermaLink="false">http://codeseeker.wordpress.com/?p=20</guid>
		<description><![CDATA[Pre-Condition

Read: “Developing Web applications with Tomcat and Eclipse” (IBM)

Setup Tomcat Management User

To use the Tomcat Management tools, you must create a user with &#8220;admin&#8221; and &#8220;manager&#8221; roles. To do this, follow these steps:

Open the tomcat-users.xml file in the CATALINA_home/conf directory with a text editor.
In this file, add the following entries to create the &#8220;admin&#8221; and [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codeseeker.wordpress.com&blog=3993442&post=20&subd=codeseeker&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><strong>Pre-Condition</strong></p>
<ul>
<li>Read: <a title="Developing Web applications with Tomcat and Eclipse" href="http://www.ibm.com/developerworks/library/os-eclipse-tomcat/index.html" target="_blank">“Developing Web applications with Tomcat and Eclipse” (IBM)</a></li>
</ul>
<p><strong>Setup Tomcat Management User<br />
</strong></p>
<p>To use the Tomcat Management tools, you must create a user with &#8220;admin&#8221; and &#8220;manager&#8221; roles. To do this, follow these steps:</p>
<ul>
<li>Open the <code>tomcat-users.xml</code> file in the <code>CATALINA_home/conf</code> directory with a text editor.</li>
<li>In this file, add the following entries to create the &#8220;admin&#8221; and &#8220;manager&#8221; roles:<code><br />
&lt;role rolename="manager"/&gt;<br />
&lt;role rolename="admin"/&gt;</code></li>
</ul>
<ul>
<li>In addition, add the following entry to create the &#8220;admin&#8221; user:<code><br />
&lt;user username="admin" password="admin" fullName="Administrator" roles="admin,manager"/&gt;</code></li>
</ul>
<ul>
<li>Save and close the file</li>
</ul>
<p><strong>Add JDBC driver support to Tomcat</strong></p>
<ul>
<li>Download <em>the latest</em> JDBC Driver from Oracle (e.g. <a href="http://www.oracle.com/technology/software/tech/java/sqlj_jdbc/htdocs/jdbc101040.html">here</a>)</li>
<li>Copy jar to <code>$CATALINA_HOME/common/lib</code></li>
</ul>
<ul>
<li>Add a <code>context.xml</code> file to the Application’s META-INF directory:</li>
</ul>
<p><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;<br />
&lt;Context&gt;<br />
...<br />
&lt;Resource<br />
name="jdbc/myoracle"<br />
auth="Container"<br />
type="javax.sql.DataSource"<br />
factory="org.apache.tomcat.dbcp.dbcp.BasicDataSourceFactory"<br />
driverClassName="oracle.jdbc.OracleDriver"<br />
username="&lt;&lt;myUsername&gt;&gt;"<br />
password="&lt;&lt;myPassword&gt;&gt;"<br />
url="jdbc:oracle:thin:@&lt;&lt;myOrcacleServer&gt;&gt;:&lt;&lt;myOrcaclePort&gt;&gt;:&lt;&lt;myOracleService&gt;&gt;"<br />
maxWait="-1"<br />
maxActive="20"<br />
maxIdle="10"<br />
validationQuery="SELECT 1+1 from dual"/&gt;<br />
...<br />
&lt;/Context&gt;</code></p>
<ul>
<li>Add the resource-ref tag to the Application’s <code>WEB-INF</code> directory (not mandatory):</li>
</ul>
<p><code> …<br />
&lt;resource-ref&gt;<br />
&lt;description&gt;Oracle Datasource&lt;/description&gt;<br />
&lt;res-ref-name&gt;jdbc/myoracle&lt;/res-ref-name&gt;<br />
&lt;res-type&gt;javax.sql.DataSource&lt;/res-type&gt;<br />
&lt;res-auth&gt;Container&lt;/res-auth&gt;<br />
&lt;/resource-ref&gt;<br />
&lt;/web-app&gt;</code></p>
<ul>
<li>Add JDBC-Example code to Servlet-Example:</li>
</ul>
<p><code>Context initContext;<br />
try {<br />
initContext = new InitialContext();<br />
Context envContext  = (Context)initContext.lookup("java:/comp/env");<br />
DataSource ds = (DataSource)envContext.lookup("jdbc/myoracle");<br />
Connection conn = ds.getConnection();</code><code> DatabaseMetaData meta = conn.getMetaData();<br />
response.getWriter().write("&lt;html&gt;&lt;body&gt;");<br />
response.getWriter().write("Driver Name : "+meta.getDriverName()+"&lt;br/&gt;");<br />
response.getWriter().write("Driver Version : "+meta.getDriverVersion()+"&lt;br/&gt;");<br />
Statement statement = conn.createStatement();<br />
String query = "select * from LOGIN_USER";<br />
//<br />
ResultSet resultSet = statement.executeQuery(query);<br />
//<br />
while (resultSet.next()) {<br />
response.getWriter().write(resultSet.getString(2)+"&lt;br/&gt;");<br />
}<br />
// close connection<br />
conn.close();<br />
conn = null;</code></p>
<ul>
<li>See also: <a href="http://tomcat.apache.org/tomcat-5.5-doc/jndi-datasource-examples-howto.html">Tomcat JNDI Datasource Examples</a></li>
</ul>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/codeseeker.wordpress.com/20/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/codeseeker.wordpress.com/20/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/codeseeker.wordpress.com/20/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/codeseeker.wordpress.com/20/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/codeseeker.wordpress.com/20/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/codeseeker.wordpress.com/20/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/codeseeker.wordpress.com/20/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/codeseeker.wordpress.com/20/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/codeseeker.wordpress.com/20/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/codeseeker.wordpress.com/20/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/codeseeker.wordpress.com/20/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/codeseeker.wordpress.com/20/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codeseeker.wordpress.com&blog=3993442&post=20&subd=codeseeker&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://codeseeker.wordpress.com/2008/06/26/eclipse-tomcat-55-jdbc-oracle-9/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/1949023e14feacc3f4e03fe833433ea4?s=96&#38;d=identicon" medium="image">
			<media:title type="html">codeseeker</media:title>
		</media:content>
	</item>
	</channel>
</rss>