Connection refused
- From: "Monica" <monica.riggins@xxxxxxxxx>
- Date: 27 Sep 2006 11:58:24 -0700
Hello,
I hope someone can help. Please let me know if this is the wrong group
for my question.
I am new to java, jsp and oracle, so I ask that you please be patient.
I am attempting to create a context-param in web.xml for my connection
string, so that when I need to change the string I will only need to do
it in one place instead of 10+ files. When I perform a pooled
connection from within my code, the connection works correctly. For
example:
.....
PooledConnection conn = null;
Connection conn2 = null;
try
{
OracleConnectionPoolDataSource ocpds= new
OracleConnectionPoolDataSource();
ocpds.setURL("jdbc:oracle:thin:@<myservername>:1526:ORCL");
ocpds.setUser("user");
ocpds.setPassword("pass");
conn = ocpds.getPooledConnection();
conn2 = conn.getConnection();
......
However, I receive an error message when I try to access my connection
string from the web.xml. Here is my code within my web.xml:
.....
<context-param>
<param-name>dbConnectionString</param-name>
<param-value>"jdbc:oracle:thin:@<myservername>:1526:ORCL"</param-value>
</context-param>
<context-param>
<param-name>databaseUser</param-name>
<param-value>"user"</param-value>
</context-param>
<context-param>
<param-name>databasePassword</param-name>
<param-value>"pass"</param-value>
</context-param>
.....
Here is how I am calling the connection string from the web.xml into my
file:
.....
PooledConnection conn = null;
Connection conn2 = null;
try
{
OracleConnectionPoolDataSource ocpds= new
OracleConnectionPoolDataSource();
String dbConnectionString =
getServletContext().getInitParameter("dbConnectionString");
String databaseUser =
getServletContext().getInitParameter("databaseUser");
String databasePassword =
getServletContext().getInitParameter("databasePassword");
ocpds.setURL(dbConnectionString);
ocpds.setUser(databaseUser);
ocpds.setPassword(databasePassword);
conn = ocpds.getPooledConnection();
conn2 = conn.getConnection();
.....
The error I receive is:
SQLException: Io exception: Connection
refused(DESCRIPTION=(TMP=)(VSNNUM=168821504)(ERR=12505)(ERROR_STACK=(ERROR=(CODE=12505)(EMFI=4))))
I have tried changing <myservername> to the ip address, but I get the
same error.
If anyone has any idea how to make this work, or if you need more
information, please let me know.
Thanks in advance,
Monica
.
- Follow-Ups:
- Re: Connection refused
- From: David Harper
- Re: Connection refused
- From: Michael Rauscher
- Re: Connection refused
- Prev by Date: Re: Stored procedures - syntax
- Next by Date: Re: Connection refused
- Previous by thread: Stored procedures - syntax
- Next by thread: Re: Connection refused
- Index(es):
Relevant Pages
|
|