IDEA的web程序下的c3p0配置文件应该放在哪?

c3p0-config.xml放在src目录下,程序以app运行没有错误 但是以web server运行,就会解析不到配置?

那我们要如何解决呢?

查看官网知道:web server程序对c3p0-config.xml的放置位置是有要求的!

By default, c3p0 will look for an XML configuration file in its classloader’s resource path under the name “/c3p0-config.xml”. That means the XML file should be placed in a directly or jar file directly named in your applications CLASSPATH, in WEB-INF/classes, or some similar location. If you prefer not to bundle your configuration with your code, you can specify an ordinary filesystem location for c3p0’s configuration file via the system property com.mchange.v2.c3p0.cfg.xml.

意思是配置文件必须放在classpath路径中,在web环境下就是classes,这个目录中也就是src中的java文件编译过来的。

根据官网所提供的信息,成功的利用c3p0链接到了数据库! 在这里插入图片描述

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 3
    评论
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值