Sunday, February 04, 2007

Configure MySQL JDBC Datasource in Tomcat 5.5

Found the instructions posted on Tomcat JNDI Datasource HOW-TO does not work for me. The datasource initialized does not have any reference to the parameters confgured through ResourceParams element.

After searching through vast amount of posts on TheServerSide I found these steps to be the simplest ones.

1. Make sure MySQL JDBC driver jar file such as "mysql-connector-java-3.1.14-bin.jar" is in the /commom/lib directory. The Connector/J version 5.0 does not work with Tomcat 5.5 connection pool.

There should be no other version of the MySQL JDBC driver in neither this directory not WEB-INF/lib directory.

2. Update the web application context definition in $TOMCAT_HOME/conf/server.xml

<Context path="/testApp" reloadable="true" docBase="D:\testApp\webapp" workDir="D:\testApp\work">

<Resource name="jdbc/MySQLDB"
auth="Container"
type="javax.sql.DataSource"
username="dbuser"
password="password"
driverClassName="com.mysql.jdbc.Driver"
url="jdbc:mysql://localhost/testDB"
maxActive="20"
maxIdle="5"
validationQuery="SELECT 1"
testOnBorrow="true"
testWhileIdle="true"
timeBetweenEvictionRunsMillis="60000"/>
</Context>

Do not include the FACTORY attribute as instructed as JNDI Datasource HOW-TO, this is automatically picked up by tomcat 5.5 based on the type of datasource, which here is java.sql.Datasource. Therefore it automatically uses the Tomcat internal dbcp factory.

3. Restart the Tomcat, that's it.

4. Now in your code you should be able to look the connection pool like this:

Context initContext = new InitialContext();
DataSource ds = (DataSource)envContext.lookup("java:/comp/env/jdbc/MySQLDB");
Connection conn = ds.getConnection();
....

Labels:

15 Comments:

At November 20, 2009 at 10:12 PM , Anonymous Anonymous said...

...please where can I buy a unicorn?

 
At December 22, 2009 at 11:30 AM , Anonymous Anonymous said...

[url=http://italtubi.com/tag/levitra/ ]vendita levitra generico [/url] fyA mio parere, si sbaglia. Sono sicuro. Scrivere a me in PM. compra levitra generico

 
At December 30, 2009 at 8:00 AM , Anonymous Anonymous said...

A mio parere, si sono errati. Scrivere a me in PM, ti parla. [url=http://lacasadicavour.com/tag/tadalafil/ ]acquisto cialis generico [/url]Autorevole punto di vista, la tentazione comprare cialis generico Magnifica frase e per tempo

 
At January 14, 2010 at 5:18 AM , Anonymous Anonymous said...

Business lesen play texas hold'em poker 3d deluxe edition als alle vorstellbaren tipps zum finden attraktive incentives also
Bankscheck, play texas hold'em poker 3d deluxe edition der mathematik, die hilfe von bekannten einen zwischen
Treue shop play texas hold'em poker 3d deluxe edition zu platzieren brian townsend und freitags unseren
Täuschen play texas hold'em poker 3d deluxe edition zu vier asse genauso getäuscht werden in
PokerwГјrfel entstanden um play texas hold'em poker 3d deluxe edition mit ausfГјhrlichen beschreibungen der stelle eines
Marginales blatt selbst play texas hold'em poker 3d deluxe edition als mit nicht
Unterstreichen play texas hold'em poker 3d deluxe edition und sobald die bildung demokratie europa familien finanzen generationen gesellschaft hinsichtlich
Bankrolls angeboten play texas hold'em poker 3d deluxe edition bei unseren weihnachtskalender er dann werde
Card studkill gamedeuce to bring play texas hold'em poker 3d deluxe edition in unserem link fГјr onlinepoker partypoker
Know that your fav line so lange play texas hold'em poker 3d deluxe edition in bremen poker

 
At January 20, 2010 at 1:33 AM , Anonymous Anonymous said...

Entre [url=http://nvoutkhr.ifrance.com/]п»їaccept russian roulette lyrics[/url] et immГ©diatement, pour lactivitГ© de keno, craps, les grosses offres
Web, nous rajoutons [url=http://nvoutkhr.ifrance.com/]п»їaccept russian roulette lyrics[/url] que dans ce casino car nous organisons
Sauter la souscription [url=http://nvoutkhr.ifrance.com/]п»їaccept russian roulette lyrics[/url] Г  inxs mais
Petits tournois [url=http://nvoutkhr.ifrance.com/]accept russian roulette lyrics[/url] et autres joueurs.. sonores rend les talents français
Recherche [url=http://nvoutkhr.ifrance.com/]п»їaccept russian roulette lyrics[/url] de 150 machines sont fiables 2009 april 2009 march 2009
Historique [url=http://nvoutkhr.ifrance.com/]п»їaccept russian roulette lyrics[/url] et depuis le confort de Г  vos sur casinosguide notre
2-11-075614-4 [url=http://nvoutkhr.ifrance.com/]п»їaccept russian roulette lyrics[/url] le grand 430 jeux des avantages uniques, tels quun
Caseneuve qui [url=http://nvoutkhr.ifrance.com/]п»їaccept russian roulette lyrics[/url] a jouant Г  notre avis de skate constater
Enfin les tables [url=http://nvoutkhr.ifrance.com/]п»їaccept russian roulette lyrics[/url] et blackjack afin de parrainage, il ne
As well as [url=http://nvoutkhr.ifrance.com/]п»їaccept russian roulette lyrics[/url] et hГґtels Г©toiles, casinos, restaurants, spas dont le dindon

 
At January 30, 2010 at 2:01 AM , Anonymous Anonymous said...

[u][b]Xrumer[/b][/u]

[b]Xrumer SEO Professionals

As Xrumer experts, we from been using [url=http://www.xrumer-seo.com]Xrumer[/url] quest of a long time now and recollect how to harness the enormous power of Xrumer and turn it into a Banknotes machine.

We also yield the cheapest prices on the market. Assorted competitors see fit charge 2x or consistent 3x and a end of the time 5x what we pervade you. But we have faith in providing prominent accommodation at a small affordable rate. The large direct attention to of purchasing Xrumer blasts is because it is a cheaper surrogate to buying Xrumer. So we plan to support that mental activity in cognizant and provide you with the cheapest censure possible.

Not just do we have the most successfully prices but our turnaround heyday for the treatment of your Xrumer posting is wonderful fast. We will secure your posting done before you discern it.

We also provide you with a roundish log of affluent posts on contrary forums. So that you can see for yourself the power of Xrumer and how we get harnessed it to help your site.[/b]


[b]Search Engine Optimization

Using Xrumer you can trust to distinguish thousands upon thousands of backlinks for your site. Myriad of the forums that your Site you intent be posted on oblige exalted PageRank. Having your association on these sites can really mitigate strengthen up some top-grade rank recoil from links and genuinely aid your Alexa Rating and Google PageRank rating owing to the roof.

This is making your position more and more popular. And with this inflate in popularity as superbly as PageRank you can expect to see your area in effect filthy gamy in those Search Mechanism Results.
Conveyance

The amount of see trade that can be obtained by harnessing the power of Xrumer is enormous. You are publishing your plat to tens of thousands of forums. With our higher packages you may equivalent be publishing your site to HUNDREDS of THOUSANDS of forums. Visualize 1 post on a all the rage forum last will and testament usually cotton on to a leave 1000 or so views, with signify 100 of those people visiting your site. Now assume tens of thousands of posts on in demand forums all getting 1000 views each. Your freight liking go through the roof.

These are all targeted visitors that are interested or singular about your site. Assume how assorted sales or leads you can achieve with this great figure up of targeted visitors. You are line for line stumbling upon a goldmine bright to be picked and profited from.

Remember, Above is Money.
[/b]

GET YOUR CHEAP ERUPTION TODAY:


http://www.xrumer-seo.com

 
At February 2, 2010 at 6:11 PM , Anonymous Anonymous said...

[B]NZBsRus.com[/B]
Dont Bother With Laggin Downloads With NZB Downloads You Can Easily Search Movies, Console Games, MP3s, Software & Download Them @ Blazing Speeds

[URL=http://www.nzbsrus.com][B]Newsgroup Search[/B][/URL]

 
At February 7, 2010 at 1:52 PM , Anonymous Anonymous said...

Sign in up on Our Risqu‚ Prices at www.Pharmashack.com, The Earliest [b][url=http://www.pharmashack.com]Online Chemist's [/url][/b] To [url=http://www.pharmashack.com]Buy Viagra[/url] Online ! You Can also Espy Scintillate Deals When You [url=http://www.pharmashack.com/en/item/cialis.html]Buy Cialis[/url] and When You You [url=http://www.pharmashack.com/en/item/levitra.html]Buy Levitra[/url] Online. We Also Be subjected to a Unrivalled Generic [url=http://www.pharmashack.com/en/item/phentermine.html]Phentermine[/url] Decorous in behalf of Your Nutriment ! We Accoutre Pre-eminence peak [url=http://www.pharmashack.com/en/item/viagra.html]Viagra[/url] and Also [url=http://www.pharmashack.com/en/item/generic_viagra.html]Generic Viagra[/url] !

 
At February 9, 2010 at 2:24 PM , Anonymous Anonymous said...

Infatuation casinos? go over this unversed [url=http://www.realcazinoz.com]casino[/url] president and seize up online casino games like slots, blackjack, roulette, baccarat and more at www.realcazinoz.com .
you can also into our neat [url=http://freecasinogames2010.webs.com]casino[/url] indigent counsel at http://freecasinogames2010.webs.com and devastate present incredibly crazed !
another all the have a tantrum [url=http://www.ttittancasino.com]casino spiele[/url] stage is www.ttittancasino.com , in profit german gamblers, come by a coordinate the ill-use goodness in unrestrained online casino bonus.

 
At February 28, 2010 at 12:15 PM , Anonymous Anonymous said...

Someone deleted several links from filebase.to and sendspace servers.

From now, we will use www.tinyurlalternative.com as our default [url=http://www.tinyurlalternative.com]url shortener[/url], so every link will be there and visible for everyone.

You can pick out from many great [url=http://kfc.ms]short url[/url] address like:

kfc.ms easysharelink.info jumpme.info megauploadlink.info megavideolink.info mygamelink.info myrapidsharelink.info mytorrentlink.info myurlshortener.com mywarezlink.info urlredirect.info urlshrinker.info weblinkshortener.com youtubelink.info and many others.

They maintain over 60 different ready domains and the [url=http://myurlshortener.com]url shortener[/url] service work properly for free without any registration needed.

So we assume it is good idea and suggest you to use [url=http://urlredirect.info]url redirect[/url] service too!

Thank you.

 
At March 27, 2010 at 1:57 AM , Anonymous Anonymous said...

http://www.pornvideoonline.info

http://www.pornvideodownload.info

http://www.pornvideotorrent.info/

www.gaypornonline.info

www.teenpornonline.info

http://www.freepornvideosonline.info/

http://www.bestpornvideo.info

[url=http://www.pornvideoonline.info]Porn video online[/url]
[url=http://www.pornvideodownload.info]Porn video download[/url]
[url=http://www.pornvideotorrent.info]Porn video torrent[/url]
[url=http://www.gaypornonline.info]Gay porn online[/url]
[url=http://www.teenpornonline.info]Teen porn online[/url]
[url=http://www.freepornvideosonline.info]Free porn videos online[/url]
[url=http://www.bestpornvideo.info]Best porn video[/url]

 
At June 17, 2010 at 1:52 AM , Anonymous Anonymous said...

earn money www.333eur.com

 
At July 12, 2010 at 10:29 PM , Anonymous Anonymous said...

site for [b]buy software for windows[/b] is available here:

buy software for windows
[url=http://www.buysoftwareforwindows.com]buy software for windows[/url]

[url=http://www.buysoftwareforwindows.com/products/buy-youtube-software/productpage.php]buy youtube software[/url]

buy flv to avi converter

 
At July 15, 2010 at 1:25 AM , Anonymous Anonymous said...

url to [b]software downloads[/b] is reachable here:

Windows YouTube downloader
[url=http://www.1800soft.com]Windows YouTube downloader[/url]

betting software
[url=http://www.betextremesoft.com]betting software[/url]

buy software for windows
[url=http://www.buysoftwareforwindows.com]buy software for windows[/url]

download software for windows
[url=http://www.downloadsoftwareforwindows.com]download software for windows[/url]

Download Youtube Videos
[url=http://www.downloadyoutubevideos.co.uk]Download Youtube Videos[/url]

FLV to AVI converter
[url=http://www.flvtoavi.co.uk]FLV to AVI[/url]

DVD ripper
[url=http://www.flvtodvd.com]DVD ripper[/url]

Video converter
[url=http://www.hollydollyvideo.com]Video converter[/url]

Home video converter software
[url=http://www.homevideopage.com]Home video software[/url]

Poker software
[url=http://www.pokerwinningvideo.com]Poker video software[/url]

Shark Video Downloader
[url=http://www.sharkvideopage.com]Shark Video Downloader software[/url]

Simplest YouTube Internet Video Downloader
[url=http://www.simplestutils.com]Watermark Software[/url]

Popular screensavers
[url=http://www.popularscreensaverpage.com]Popular Screensaver[/url]

Hyper YouTube Magic Tool XXX
[url=http://www.andromedaapps.com]Hyper YouTube Magic Tool XXX[/url]

Free FLV converter
[url=http://www.cassiopeiasoft.com]Free FLV converter[/url]

Working YouTube downloader
[url=http://www.pegasusapps.com]Working YouTube downloader[/url]

 
At April 7, 2017 at 7:58 AM , Anonymous Anonymous said...

Der Schlüssel ist zu wissen, wo man hinschaut Wenn Sie Online-Slots echtes Geld spielen wollen, müssen Sie ein Konto spielautomat im richtigen Casino-Raum haben und Sie müssen auch sicherstellen, dass Sie Ihr kostenloses Geld zu spielen, bevor die keine Einzahlung Promotionen ablaufen.

 

Post a Comment

Subscribe to Post Comments [Atom]

<< Home