birt如何使用JNDI

 
转载过来收藏,以后会用的着
birt如何使用jndi? (2007-10-12 15:40)
分类: java

1. Install Your JDBC Driver 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.

2. Declare Your Resource Requirements

In the webapps/WebViewerExample/WEB-INF/web.xml file, add the following entry to setup your JNDI service:

   <resource-ref> 
       <description>Resource reference to a factory for java.sql.Connection</description> 
       <res-ref-name>jdbc/MySqlDB</res-ref-name> 
       <res-type>javax.sql.DataSource</res-type> 
       <res-auth>Container</res-auth> 
   </resource-ref> 

where MySqlDB is your JNDI name.

3. Configure Tomcat's Resource Factory

配置数据源请参照

http://www.matrix.org.cn/thread.shtml?forumId=27&topicId=22207

To configure Tomcat's resource factory, add an element like this to the webapps/WebViewerExample/META-INF/context.xml file in the web application.

 <Resource name="jdbc/MySqlDB" 
       auth="Container" 
           type="javax.sql.DataSource" 
       maxActive="5" maxIdle="-1" maxWait="10000" 
       username="myuser" password="mypassword" 
           driverClassName="com.mysql.jdbc.Driver" 
       url="jdbc:mysql://localhost:3306/classicmodels" 
       description="MySQL Sfdata DB"/> 


4. Set the JNDI property in your report to: java:comp/env/jdbc/MySqlDB

 
注意:1、开发阶段配置jdbc,直接链接数据库。
2、发布后,如果jdbc和jndi都配置了,会首先寻找jndi
What is the precedence when both JDBC URL and JNDI name are specified?
 If your report design contains a JDBC data source defined with both JDBC Driver URL and JNDI name, then JNDI service will be used first and JDBC driver will be used as fallback. The username and password properties, if specified, are used in both cases. When you need to ensure that JNDI service is really used, increase logging level of BIRT engine; in case of JDBC fallback you will see JNDI lookup errors in the logs.

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值