Hi,
I am using tomcat 4.1 and Oracle 8i. I am using connection pool which tomcat provides. I have a requirement to login into database using the user Id and Password that the user provides in login screen. This is to verify that the user is a database user. I donot want to use the User Id and Password that is configured in Server.xml while logging in. Is there any way that I can get the connection using the User's User Id and Password? Please let me know
Thanks in advance
Prasanna Kumar K
-
Tomcat DataSource (2 messages)
- Posted by: Prasanna K
- Posted on: January 22 2004 08:19 EST
Threaded Messages (2)
- Tomcat DataSource by stephen smithstone on January 22 2004 09:26 EST
- Tomcat DataSource by Irshad Buchh on February 10 2004 03:42 EST
-
Tomcat DataSource[ Go to top ]
- Posted by: stephen smithstone
- Posted on: January 22 2004 09:26 EST
- in response to Prasanna K
your could try getting the datasource from the context then use the
.getConnection( String username , String password ) on the datasource object and then if the connection is null or a SQLException is thrown you can deal with it -
Tomcat DataSource[ Go to top ]
- Posted by: Irshad Buchh
- Posted on: February 10 2004 03:42 EST
- in response to stephen smithstone
Hi,
Assume that the JNDI of the data source is jdbc/OracleDS...
String id = request.getParameter("userid");
String passWord = request.getParameter("password");
InitialContext ctx = new InitialContext();
DataSource ds = (DataSource)ctx.lookup("jdbc/OracleDS");
Connection conn = ds.getConnection(id,passWord);
....
//go ahead with the database
Irshad.