proxool连接池问题
我以WEB方式构造proxool连接池总是报:
程序代码:
2007-8-16 15:59:36 org.logicalcobwebs.proxool.ProxoolFacade registerConnectionPool
信息: Proxool 0.9.0RC3 (10-Jan-2007 01:38)
2007-8-16 15:59:36 org.logicalcobwebs.proxool.ProxoolDriver connect
严重: Problem
org.logicalcobwebs.proxool.ProxoolException: Attempt to refer to a unregistered pool by its alias 'dw'
at org.logicalcobwebs.proxool.ConnectionPoolDefinition.doChange(ConnectionPoolDefinition.java:250)
at org.logicalcobwebs.proxool.ConnectionPoolDefinition.<init>(ConnectionPoolDefinition.java:147)
at org.logicalcobwebs.proxool.ProxoolFacade.registerConnectionPool(ProxoolFacade.java:96)
at org.logicalcobwebs.proxool.ProxoolDriver.connect(ProxoolDriver.java:77)
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at hr.bao.dao.DaoFactory.getProConnection(DaoFactory.java:17)
at hr.bao.dao.TestConn.findElement(TestConn.java:12)
at hr.bao.dao.TestConn.main(TestConn.java:27)
java.sql.SQLException: org.logicalcobwebs.proxool.ProxoolException: Attempt to refer to a unregistered pool by its alias 'dw'
at org.logicalcobwebs.proxool.ProxoolDriver.connect(ProxoolDriver.java:109)
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at hr.bao.dao.DaoFactory.getProConnection(DaoFactory.java:17)
at hr.bao.dao.TestConn.findElement(TestConn.java:12)
at hr.bao.dao.TestConn.main(TestConn.java:27)
Exception in thread \"main\" java.lang.NullPointerException
at hr.bao.dao.TestConn.findElement(TestConn.java:13)
at hr.bao.dao.TestConn.main(TestConn.java:27)
代码如下:
程序代码:
连接工厂:
public static Connection getProConnection(){
try {
Class.forName(\"org.logicalcobwebs.proxool.ProxoolDriver\");
conn = DriverManager.getConnection(\"proxool.dw\");
} catch (SQLException e) {
e.printStackTrace();
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
return conn;
}
程序代码:
持久类:
public void findElement(){
try {
Connection conn = DaoFactory.getProConnection();
Statement st = conn.createStatement();
String sql = \"select DB_LINK from T_WH_ETL_JOBS\";
ResultSet rs = st.executeQuery(sql);
while(rs.next()){
System.out.println(rs.getString(1));
}
} catch (SQLException e) {
e.printStackTrace();
}
}
public static void main(String[] args) {
new TestConn().findElement();
}
程序代码:
Web.xml配置
<servlet>
<servlet-name>ServletConfigurator</servlet-name>
<servlet-class>org.logicalcobwebs.proxool.configuration.ServletConfigurator</servlet-class>
<init-param>
<param-name>propertyFile</param-name>
<param-value>WEB-INF\config\proxool.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
proxool.xml配置
<?xml version=\"1.0\" encoding=\"UTF-8\"?>
<something-else-entirely>
<proxool>
<alias>dw</alias>
<driver-url>jdbc:Oracle:thin:@10.66.3.106:1521:dwdvlp</driver-url>
<driver-class>oracle.jdbc.driver.OracleDriver</driver-class>
<driver-properties>
<property name=\"user\" value=\"wh\"/>
<property name=\"password\" value=\"wh\"/>
</driver-properties>
<maximum-connection-count>20</maximum-connection-count>
</proxool>
</something-else-entirely>
在线急等 不知道有没有知道是为什么
搜索更多相关主题的帖子:
proxool 池问题 org WEB Attempt
----------------解决方案--------------------------------------------------------
conn = DriverManager.getConnection("proxool.dw"); //应该是这里的问题
org.logicalcobwebs.proxool.ProxoolException: Attempt to refer to a unregistered pool by its alias 'dw'
//你这个的错误是 尝试查询 未注册的连接池别名'dw' 也就是说你的"proxool.dw"不存在
----------------解决方案--------------------------------------------------------
我也知道是这里的问题 但我这里已经注册了啊 在WEB里有写啊 TOMCAT启动的时候就会加载啊
----------------解决方案--------------------------------------------------------
proxool.xml配置
<?xml version="1.0" encoding="UTF-8"?>
<something-else-entirely>
<proxool>
<alias>dw</alias>
<driver-url>jdbc:Oracle:thin:@10.66.3.106:1521:dwdvlp</driver-url>
<driver-class>oracle.jdbc.driver.OracleDriver</driver-class>
<driver-properties>
<property name="user" value="wh"/>
<property name="password" value="wh"/>
</driver-properties>
<maximum-connection-count>20</maximum-connection-count>
</proxool>
</something-else-entirely>
你这个是写在web.xml中吗??
----------------解决方案--------------------------------------------------------
你在哪个里面写了加载 proxool.xml 这个文件的
是不是忘记写加载 proxool.xml文件了
----------------解决方案--------------------------------------------------------
以下是引用Gramary在2007-8-16 20:54:56的发言:
proxool.xml配置
<?xml version="1.0" encoding="UTF-8"?>
<something-else-entirely>
<proxool>
<alias>dw</alias>
<driver-url>jdbc:Oracle:thin:@10.66.3.106:1521:dwdvlp</driver-url>
<driver-class>oracle.jdbc.driver.OracleDriver</driver-class>
<driver-properties>
<property name="user" value="wh"/>
<property name="password" value="wh"/>
</driver-properties>
<maximum-connection-count>20</maximum-connection-count>
</proxool>
</something-else-entirely>
你这个是写在web.xml中吗??
proxool.xml配置
<?xml version="1.0" encoding="UTF-8"?>
<something-else-entirely>
<proxool>
<alias>dw</alias>
<driver-url>jdbc:Oracle:thin:@10.66.3.106:1521:dwdvlp</driver-url>
<driver-class>oracle.jdbc.driver.OracleDriver</driver-class>
<driver-properties>
<property name="user" value="wh"/>
<property name="password" value="wh"/>
</driver-properties>
<maximum-connection-count>20</maximum-connection-count>
</proxool>
</something-else-entirely>
你这个是写在web.xml中吗??
这个不是写在WEB。xml里的这个是写单写的专门为连接池写的配置文件,我在WEB里加载这个文件
----------------解决方案--------------------------------------------------------