Our approach to DBCP uses the Jakarta-Commons database connection pool. But first, we need to configure the JNDI DataSource in Tomcat by adding a declaration for the resource to server.xml file, which resides inside the /conf directory of your Tomcat installation (indicated by the environment variable CATALINA_HOME). The JNDI DataSource is used as a factory for connections. One of the major advantages of using a configuration like this is that the characteristics of the pool can be changed without affecting the application code.
server.xml ========================================
.........
=================================================
<Host >
<Context path="/edi-web" docBase="edi-web" debug="5"
reloadable="true" crossContext="true">
<Resource name="EDI-DS" auth="Container"
type="javax.sql.DataSource" removeAbandoned="true"
removeAbandonedTimeout="30" maxActive="100"
maxIdle="30" maxWait="10000" username="user"
password="passws"
driverClassName="oracle.jdbc.driver.OracleDriver"
url="jdbc:oracle:thin:@192.168.0.1:1521:SME1" />
</Context>
</Host>
In this example we have configured the DataSource EDI-DS which references an Oracle connection.
Use of the JDBC Data Sources requires that you make an appropriate JDBC driver available to both Tomcat internal classes and to your web application. This is most easily accomplished by installing the driver's JAR file(s) into the $CATALINA_HOME/common/lib directory, which makes the driver available both to the resource factory and to your application
(Notice: Tomcat 6 library repository is $CATALINA_HOME/lib )
We can configure a maximum number of DB connections in the pool. Make sure you choose a maximum connection count large enough to handle all of your database connections--alternatively, you can set 0 for no limit.
We can also specify the maximum time (in milliseconds) to wait for a database connection to become available, which in this example is 30 seconds.
Further, we can set the maximum number of idle database connections to be retained in the pool. Set this value to -1 for no limit. The most optimal performance is attained when the pool in its steady state contains just enough connections to service all concurrent connection requests, without having to create new physical database connections at runtime
Retrieving the Connection
Getting a connection form the DataSource is just a matter of looking up the Datasource from the InitialContext and then retrieve the associated connection:
Context ctx = new InitialContext();
DataSource ds = (DataSource) ctx.lookup("java:/comp/env/EDI-DS");
Connection conn = ds.getConnection();
In other words, it looks like it is running twice. Any ideas why this would be? In my server.xml, I do have two Contexts with the same docbase. Is that what's causing this?
RispondiEliminanahrungsergänzung
Good article but all attributes for the resource tag, are available for each Tomcat's version ?
RispondiElimina很好啊 ..................................................
RispondiEliminaExtremes meet. 長處即短處。物極必反。否極泰來!一切會更好! ....................................................
RispondiElimina台灣美女自拍寫真圖片夫妻自拍論壇學生妹做愛自拍學生妹做愛自拍照片學生妹做愛自拍影片台灣18情色文學網台灣18影片台南留言台南正妹無名台南元交只有成人貼圖區只有成人圖區只有貼途區只有圖區只有圖貼區台中人聊天(f1)台中人聊天室(f1)台中之都聊天室台中色情按摩台中聊天網台中援留言板台妹圖台南一夜留言台灣18線上影片台灣av女優免費看台灣女自拍台灣女星寫真圖片台灣少女線上自慰偷拍影片台灣文學小說台灣文學網小弟弟影片交流區 小弟弟影片區 美女遊戲情色自拍
RispondiEliminathank you for you to make me learn more,thank you∩0∩
RispondiElimina路過~很有趣吶............................
RispondiEliminahow do u do?................................................................
RispondiElimina非常感謝~3Q~....................................................
RispondiElimina良言一句三冬暖,惡語傷人六月寒。......................................................
RispondiElimina欣賞是一種美德~回應是最大的支持^^........................................
RispondiElimina本土辣妹貼圖站 辣妹城人網 辣妹貼圖站自拍本土 辣妹貼圖站自拍 跟辣妹做愛短片 美國辣妹短片 性感辣妹圖 辣妹好 辣妹比基尼 日本辣妹寫真集 免費辣妹 巨乳辣妹影片 辣妹裸體影片 辣妹貼影 辣妹脫衣影片 巨乳辣妹脫衣影片 巨乳辣妹裸體影片 巨乳辣妹裸體 辣妹服務 辣妹直播服務 視訊辣妹照片 辣妹有約綜藝野球 辣妹泰正點 辣妹影片網 日本辣妹裸體 天天看辣妹 神算辣妹 辣妹情貼圖 辣妹奶奶 裸體的辣妹 藝術台辣妹有約 辣妹性感 寫真辣妹 無碼辣妹 台灣藝術台的辣妹有約 辣妹色情片 清涼辣妹自拍 辣媽辣妹後 辣妹性感照片 辣妹好色情片 辣妹圖貼區 辣妹裸體寫真 辣妹自拍照 辣妹生活照片 韓國寫真辣妹 絲襪辣妹自拍 辣妹留言版 辣妹色網 裸體辣妹照片 辣妹偷拍影片 美女短片試看av電影 美女的照片 美女爆乳 網路美女的照片 票選2009美女
RispondiElimina發表,是一種抒發:好的心情可以一再的回味發酵;壞的心情就讓它留在文字裡吧!加油!........................................
RispondiEliminaThe more haste, the less speed. ............................................................
RispondiEliminaSay not all that you know, believe not all that you hear. ............................................................
RispondiElimina成人電影線上看 ut男視訊 聊天事ut 免費a觀看 絲襪同志交友 av女優性交影影片 性感褲襪美女寫真 免費影片網 色情自拍偷拍 愛的聊天室 女女愛愛 av情趣用品 18卡通漫畫 少女自拍網 熊貓影城 a片圖 情色卡漫 a色情影片 一夜情 383 完美情人視訊網站 玩美女人 免費影片 正妹辣妹 人妻遊戲 熟女 免費視訊 視訊聊天室 a圖片a 視訊聊天 85cc 微風成人交友區 嘟嘟 777 小魔女自拍貼圖 台灣援交妹 情人視訊 辣妹脫衣 av影片 洪爺影城 大奶熟女 sexy情色 a片 巨乳 性愛情慾貼圖 後宮電影院 jack 限制級 色情電話0204 激情性愛 明星走光
RispondiElimina工作,是愛的具體化~~~~努力吧!......................................................................
RispondiElimina這樣的情感,真是值得人羨慕.................................................................
RispondiElimina良言一句三冬暖,惡語傷人六月寒。....................................................................
RispondiElimina死亡是悲哀的,但活得不快樂更悲哀。.................................................................
RispondiElimina當一個人內心能容納兩樣相互衝突的東西,這個人便開始變得有價值了。............................................................
RispondiElimina向著星球長驅直進的人,反比踟躕在峽路上的人,更容易達到目的。............................................................
RispondiElimina支持好的blog~繼續加油~~..................................................................
RispondiElimina好熱鬧喔 大家踴躍的留言 讓部落格更有活力..................................................................
RispondiElimina很喜歡看看別人的生活故事,謝謝您的分享哦~~............................................................
RispondiElimina河水永遠是相同的,可是每一剎那又都是新的。..................................................
RispondiEliminaforgive others but not yourself...................................................
RispondiElimina快下班囉~來幫你加油~~.................................................................
RispondiElimina好的開始並不代表會成功,壞的開始並不代表是失敗............................................................
RispondiElimina愛,拆開來是心和受兩個字。用心去接受對方的一切,用心去愛對方的所有。......................................................................
RispondiElimina多謝美味的心靈雞湯......................................................................
RispondiEliminaJudge not a book by its cover.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
RispondiElimina世間事沒有一樣沒有困難,只要有信心去做,至少可以做出一些成績。..................................................
RispondiElimina到處逛逛~~來繞繞留個言囉~~~~............................................................
RispondiElimina來打聲招呼-大家好!!!............................................................
RispondiElimina走召糸及言贊白勺口拉............................................................
RispondiElimina一棵樹除非在春天開了花,否則難望在秋天結果。......................................... ........................
RispondiEliminaLearning makes life sweet.......................................................................
RispondiElimina愛看您的新文章!加油!. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
RispondiElimina