Enjoy yourself,and don't care about others' thinking!
----TiGERTiAN
BlogJava
首頁
新隨筆
聯(lián)系
聚合
管理
隨筆-348 評論-598 文章-0 trackbacks-0
Grails使用JNDI方法
今天搞了一下Grails的JNDI配置,步驟如下:
1、在應(yīng)用目錄下面,META-INF下建立一個Context.xml文件,內(nèi)容如下:
<?
xml version="1.0" encoding="UTF-8"
?>
<
Context
path
="/game_hall_local"
docBase
="game_hall_local"
debug
="5"
reloadable
="true"
crossContext
="true"
>
<!--
maxActive: Maximum number of dB connections in pool. Make sure you
configure your mysqld max_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 10 seconds. An Exception is thrown if
this timeout is exceeded. Set to -1 to wait indefinitely.
-->
<!--
username and password: MySQL dB username and password for dB connections
-->
<!--
driverClassName: Class name for the old mm.mysql JDBC driver is
org.gjt.mm.mysql.Driver - we recommend using Connector/J though.
Class name for the official MySQL Connector/J driver is com.mysql.jdbc.Driver.
-->
<!--
url: The JDBC connection url for connecting to your MySQL dB.
-->
<
Resource
name
="jdbc/mydatasource"
auth
="Container"
type
="javax.sql.DataSource"
driverClassName
="com.mysql.jdbc.Driver"
url
="jdbc:mysql://localhost:3306/game_hall_cms?useUnicode=true&characterEncoding=UTF-8"
username
="root"
password
="root"
maxActive
="20"
maxIdle
="10"
maxWait
="-1"
/>
</
Context
>
2、在DataSource.groovy里面將部署連接配置修改成如下代碼:
production
{
dataSource
{
pooled
=
false
dbCreate
=
"
update
"
jndiName
=
"java:comp/env/
jdbc/mydatasource
"
}
}
3、在應(yīng)用工程的scripts目錄下,簡歷_Event.groovy文件,內(nèi)容如下:
import
groovy.xml.StreamingMarkupBuilder
if
(Environment.current
==
Environment.PRODUCTION)
{
eventWebXmlEnd
=
{String tmpfile
->
def root
=
new
XmlSlurper().parse(webXmlFile)
//
add the data source
root.appendNode
{
'
resource-ref
'
{
'
description
'
(
'
The JNDI Database resource
'
)
'
res-ref-name
'
(
'
jdbc/mydatasource
'
)
'
res-type
'
(
'
javax.sql.DataSource
'
)
'
res-auth
'
(
'
Application
'
)
}
}
webXmlFile.text
=
new
StreamingMarkupBuilder().bind
{
mkp.declareNamespace(
""
:
"
http://java.sun.com/xml/ns/j2ee
"
)
mkp.yield(root)
}
}
}
4、可以進(jìn)行生產(chǎn)環(huán)境編譯,這樣在生產(chǎn)環(huán)境中部署,就可以使用JNDI了。
注意:sql連接的url中如果有&需要轉(zhuǎn)移成&,否則他會報 需要分隔符“;”作為終止符號 的錯誤。
---------------------------------------------------------
專注移動開發(fā)
Android, Windows Mobile, iPhone, J2ME, BlackBerry, Symbian
posted on 2010-02-08 15:28
TiGERTiAN
閱讀(1738)
評論(0)
編輯
收藏
所屬分類:
Java
、
Grails
新用戶注冊
刷新評論列表
只有注冊用戶
登錄
后才能發(fā)表評論。
網(wǎng)站導(dǎo)航:
博客園
IT新聞
Chat2DB
C++博客
博問
管理
相關(guān)文章:
OSGi and Hadoop and Node.js
javacc工具小記
MyEclipse 6.5新序列號,到2013年
OtaNotifier.java
Java中無符號整數(shù)
C#的BinaryWriter和Java的DataInputStream之間的數(shù)據(jù)相互轉(zhuǎn)換
在Mac下面下載Android源代碼
[轉(zhuǎn)]Java通過XML Schema校驗XML
[轉(zhuǎn)]JAVA上加密算法的實現(xiàn)用例
LG GW880(Ophone)開啟ADB調(diào)試模式
專注移動開發(fā)--Windows Mobile, Android, iPhone, J2ME, BlackBerry, Symbian, Windows Phone
慢慢混,慢慢學(xué)
<
2010年2月
>
日
一
二
三
四
五
六
31
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
1
2
3
4
5
6
7
8
9
10
11
12
13
常用鏈接
我的隨筆
我的評論
我的參與
最新評論
留言簿
(43)
給我留言
查看公開留言
查看私人留言
隨筆分類
(402)
Ajax(4)
Android(58)
BlackBerry(8)
C/C++(3)
Design Patterns(6)
Discuz!NT(1)
DotNet(26)
Feeling(61)
Flex(4)
Grails(2)
Hibernate(1)
iPhone(5)
J2ME(11)
Java(99)
JSF(26)
Linux(18)
MapXtreme(9)
Objective c(1)
Oracle(6)
Other technique(20)
Perl/Python(1)
Roller (10)
Symbian
VB/ASP(7)
WebWork(3)
Windows Mobile(10)
WindowsPhone(2)
隨筆檔案
(306)
2017年5月 (1)
2016年8月 (1)
2015年11月 (1)
2015年2月 (1)
2015年1月 (1)
2013年12月 (1)
2013年5月 (1)
2013年4月 (1)
2012年9月 (1)
2012年7月 (1)
2012年6月 (1)
2012年5月 (2)
2012年4月 (1)
2012年2月 (2)
2012年1月 (1)
2011年11月 (2)
2011年10月 (1)
2011年9月 (1)
2011年8月 (2)
2011年7月 (3)
2011年6月 (2)
2011年3月 (3)
2011年2月 (4)
2011年1月 (15)
2010年12月 (1)
2010年11月 (2)
2010年10月 (6)
2010年9月 (12)
2010年8月 (3)
2010年7月 (2)
2010年6月 (6)
2010年5月 (14)
2010年4月 (7)
2010年3月 (16)
2010年2月 (10)
2010年1月 (14)
2009年12月 (12)
2009年11月 (5)
2009年10月 (3)
2009年9月 (2)
2009年8月 (3)
2009年6月 (1)
2009年4月 (2)
2009年3月 (2)
2009年1月 (3)
2008年12月 (3)
2008年11月 (20)
2008年10月 (17)
2008年9月 (3)
2008年4月 (1)
2008年3月 (2)
2008年2月 (8)
2008年1月 (1)
2007年11月 (2)
2007年10月 (13)
2007年9月 (3)
2007年7月 (4)
2007年6月 (2)
2007年5月 (12)
2007年4月 (15)
2007年3月 (6)
2007年2月 (2)
2007年1月 (1)
2006年7月 (2)
2006年4月 (1)
2006年1月 (1)
2005年11月 (1)
2005年8月 (1)
2005年7月 (9)
相冊
我正在讀的書
我的好友們
JavaBy
有心就有翼 有夢就會飛--MC
搜索
積分與排名
積分 - 813964
排名 - 50
最新評論
1.?re: Hibernate三種狀態(tài)的區(qū)分,以及save,update,saveOrUpdate,merge等的使用[未登錄]
哈哈~
--a
2.?re: onInterceptTouchEvent和onTouchEvent調(diào)用時序
@米其林的微笑
在你的子view重寫ontouchevent方法就行
--kxt
3.?re: Android彈出撥號界面和撥打電話實現(xiàn)
這找不到call是怎么回事?現(xiàn)在有別的方法實現(xiàn)這個功能嗎?
--firetomato
4.?re: Android彈出撥號界面和撥打電話實現(xiàn)
請我dial和call方法有什么區(qū)別么?
--jaime
5.?re: Android文字跑馬燈控件(文本自動滾動控件)
如何讓滾動的速度快一點啊??
--學(xué)鳥
閱讀排行榜
1.?onInterceptTouchEvent和onTouchEvent調(diào)用時序(38730)
2.?Android的Intent和IntentFilter應(yīng)用說明一例(37720)
3.?Hibernate三種狀態(tài)的區(qū)分,以及save,update,saveOrUpdate,merge等的使用(34358)
4.?Android中短信攔截解決方案(31109)
5.?Android中ContentProvider和ContentResolver使用入門(21437)
評論排行榜
1.?【JSF】Richfaces復(fù)選框樹(Checkbox tree)的權(quán)限分配的解決方案(69)
2.?JSF中動態(tài)生成HtmlMessage控件出錯的解決辦法(38)
3.?hibernate中at org.hibernate.tuple.AbstractEntityTuplizer.createProxy(AbstractEntityTuplizer.java:372)異常的解決方法(27)
4.?這兩天用Flex寫了一個多媒體播放器(19)
5.?Android文字跑馬燈控件(文本自動滾動控件)(17)
Powered by:
博客園
模板提供:
滬江博客
Copyright ©2025 TiGERTiAN
主站蜘蛛池模板:
亚洲av无码专区在线
|
亚洲精品乱码久久久久66
|
美女网站在线观看视频免费的
|
亚洲Av无码专区国产乱码DVD
|
成熟女人特级毛片www免费
|
91在线视频免费观看
|
美女被爆羞羞网站在免费观看
|
亚洲高清不卡视频
|
亚洲视频一区二区在线观看
|
亚洲情a成黄在线观看
|
2020久久精品亚洲热综合一本
|
亚洲欧洲日产v特级毛片
|
亚洲人成网站在线播放vr
|
亚洲精品NV久久久久久久久久
|
性xxxx视频播放免费
|
亚洲欧洲无码AV不卡在线
|
亚洲午夜在线播放
|
亚洲乱码在线视频
|
亚洲综合久久一本伊伊区
|
亚洲剧情在线观看
|
国产亚洲中文日本不卡二区
|
国产猛烈高潮尖叫视频免费
|
亚洲精品乱码久久久久久蜜桃
|
成人免费看片又大又黄
|
日本视频免费在线
|
www.亚洲精品.com
|
97国产免费全部免费观看
|
114一级毛片免费
|
免费人成在线观看视频播放
|
久久永久免费人妻精品下载
|
222www在线观看免费
|
麻豆精品国产免费观看
|
亚洲无线观看国产精品
|
337p欧洲亚洲大胆艺术
|
国产精品亚洲精品日韩电影
|
亚洲国产人成网站在线电影动漫
|
在线永久免费的视频草莓
|
青青青青青青久久久免费观看
|
日本成人在线免费观看
|
亚洲AV无码成人精品区天堂
|
亚洲成人激情小说
|