• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

how to configure oracle DataSource into Tomcat 6

 
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
how to configure oracle DataSource into Tomcat 6.

i want some sample server.xml and web.xml files
 
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I use postgres. Oracle will be the same except for the connection url.

You need this in web.xml: (child of root element)
<!-- Database configuration for each DataSource is in xpertda/META-INF/context.xml -->
<resource-ref>
<description>The PostgreSQL DataSource for the xpertda web app.</description>
<res-ref-name>jdbc/postgres</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>

You need this in context.xml in the directory <web-app>/META-INF: (Context element is the root element)

<?xml version="1.0" encoding="UTF-8"?>
<Context reloadable="true" crossContext="true">

<!-- maxActive: Maximum number of dB connections in pool. Make sure you
configure your connections large enough to handle all of your db connections.
Set to -1 for no limit. -->

<!-- maxIdle: Maximum number of idle dB connections to retain in pool. Set
to -1 for no limit. See also the DBCP documentation on this and the
minEvictableIdleTimeMillis configuration parameter. -->

<!-- maxWait: Maximum time to wait for a dB connection to become available
in ms, in this example 5 seconds. An Exception is thrown if this timeout
is exceeded. Set to -1 to wait indefinitely. -->

<!-- username and password: dB username and password for dB connections. -->

<!-- driverClassName: Class name for the JDBC driver. -->

<!-- url: The JDBC connection url for connecting to your dB. -->

<Resource name="jdbc/postgres"
auth="Container"
type="javax.sql.DataSource"
maxActive="-1" maxIdle="-1" maxWait="5000" validationQuery="select 1"
username="webuser" password="webuser"
driverClassName="org.postgresql.Driver"
url="jdbc:postgresql://localhost:5432/test" />

</Context>
 
Donald Winston
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I forgot to mention you have to copy oracle jdbc driver to Tomcat's library not you web app's library.
 
it's a teeny, tiny, wafer thin ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic