i have some jsp code that reads in Servlet Context parameters from a web.xml file. these parameters hold database connection information so each time the SID or user/password or servername changesm, the programmer doesnt have to go re-code; the user can just change the web.xml file.
<context-param>
<description>database user name</description>
<param-name>user</param-name>
<param-value>guest</param-value>
</context-param>
<context-param>
<description>database password</description>
<param-name>password</param-name>
<param-value>1234</param-value>
</context-param>
i read in these using this section of bean class code:
String user = servletContext.getInitParameter("user");
String pass = servletContext.getInitParameter("password");
The Problem:
next i want to do the database connection to retrieve some data:
Class.forName("oracle.jdbc.driver.OracleDriver");
dbConnection = DriverManager.getConnection(conn_url, user, pass);
where conn_url was a string made up of hostname(or ip address) and the port number.
At any rate the dbConnection fails:
java.sql.SQLException: ORA-01017: invalid username/password; logon denied
even though i echo out what the String values are and they are what they should be.
if i go and say:
user = "guest";
pass = "1234";
assigning them directly then it works fine.
I don't get it. Ive rattled my brain all day. Clearly the getConnection looks for 3 Strings. I am at a loss. Any help would be appreciated.