各位大虾们好:
我在学习中遇到些问题我在创建tomcat连接池的时候遇到个问题希望大家能帮助我
我在Tomcat 5.0\conf\server.xml中的配置文件如下:
<Context path="/test" docBase="test"
debug="5" reloadable="true" crossContext="true">
<Resource name="jdbc/test" auth="Container"
type="javax.sql.DataSource"/> <ResourceParams name="jdbc/test">
<parameter>
<name>factory</name>
<value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
</parameter>
<!-- Class name for the official Orcale9i Connector/J driver -->
<parameter>
<name>driverClassName</name>
<value>oracle.jdbc.driver.OracleDriver</value>
</parameter>
<!-- The JDBC connection url for connecting to your Orcale9i dB.
The autoReconnect=true argument to the url makes sure that the
JDBC Driver will automatically reconnect if orcale closed the
connection. orcale by default closes idle connections after 8 hours.
-->
<parameter>
<name>url</name>
<value>jdbc:oracle:thin:@127.0.0.1:1521:smap</value>
</parameter>
<!-- Orcale9i dB username and password for dB connections --> <parameter>
<name>username</name>
<value>smap</value>
</parameter>
<parameter>
<name>password</name>
<value>smap$lf</value>***问题在这里在程序中不认“$”***
</parameter>
<parameter>
<!-- 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 0 for no limit.
-->
<name>maxActive</name>
<value>20</value>
</parameter>
<parameter>
<!-- 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.
-->
<name>maxIdle</name>
<value>10</value>
</parameter>
<parameter>
<!-- 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.
-->
<name>maxWait</name>
<value>-1</value>
</parameter>
</ResourceParams>
</Context>
调用程序如下:
....................................
Context initCtx=new InitialContext();
Context envCtx=(Context)initCtx.lookup("java:comp/env");
ds=(DataSource)envCtx.lookup("jdbc/test");
if(ds!=null)
{
out.println("已经获得DataSource");
out.println("<br>");
Connection con=ds.getConnection();/*调试中这里报错原因就是在读取密码时程序不能读出里面的那个"$",请教各位这个问题如何处理-_-*/
...............................错误信息如下:
Cannot create PoolableConnectionFactory (ORA-01017: invalid username/password; logon denied
)
我在学习中遇到些问题我在创建tomcat连接池的时候遇到个问题希望大家能帮助我
我在Tomcat 5.0\conf\server.xml中的配置文件如下:
<Context path="/test" docBase="test"
debug="5" reloadable="true" crossContext="true">
<Resource name="jdbc/test" auth="Container"
type="javax.sql.DataSource"/> <ResourceParams name="jdbc/test">
<parameter>
<name>factory</name>
<value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
</parameter>
<!-- Class name for the official Orcale9i Connector/J driver -->
<parameter>
<name>driverClassName</name>
<value>oracle.jdbc.driver.OracleDriver</value>
</parameter>
<!-- The JDBC connection url for connecting to your Orcale9i dB.
The autoReconnect=true argument to the url makes sure that the
JDBC Driver will automatically reconnect if orcale closed the
connection. orcale by default closes idle connections after 8 hours.
-->
<parameter>
<name>url</name>
<value>jdbc:oracle:thin:@127.0.0.1:1521:smap</value>
</parameter>
<!-- Orcale9i dB username and password for dB connections --> <parameter>
<name>username</name>
<value>smap</value>
</parameter>
<parameter>
<name>password</name>
<value>smap$lf</value>***问题在这里在程序中不认“$”***
</parameter>
<parameter>
<!-- 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 0 for no limit.
-->
<name>maxActive</name>
<value>20</value>
</parameter>
<parameter>
<!-- 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.
-->
<name>maxIdle</name>
<value>10</value>
</parameter>
<parameter>
<!-- 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.
-->
<name>maxWait</name>
<value>-1</value>
</parameter>
</ResourceParams>
</Context>
调用程序如下:
....................................
Context initCtx=new InitialContext();
Context envCtx=(Context)initCtx.lookup("java:comp/env");
ds=(DataSource)envCtx.lookup("jdbc/test");
if(ds!=null)
{
out.println("已经获得DataSource");
out.println("<br>");
Connection con=ds.getConnection();/*调试中这里报错原因就是在读取密码时程序不能读出里面的那个"$",请教各位这个问题如何处理-_-*/
...............................错误信息如下:
Cannot create PoolableConnectionFactory (ORA-01017: invalid username/password; logon denied
)
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货