HI All
I want to get username from session inside getConnection method without sending that as parameter.
My connection method is defined like this
public static Connection getConnection(
String from)
{
Connection conn = null;
if(dataSource == null)
{
try
{
InitialContext ic= new InitialContext();
dataSource= (DataSource) ic.lookup("jdbc/OracleDS");
}
catch (NamingException e)
{
e.printStackTrace();
return null;
}
}
try
{
conn= dataSource.getConnection();
conn.setAutoCommit(false);
return conn;
}
catch(SQLException e)
{
e.printStackTrace();
return null;
}
}
I want to get a username inside this from session.THis method is getting called from stateless session beans.
I dont want to change the parameter because i have to reflect that at all places.Iwant to store username somewhere from where i acn fetch it inside this method .Is there any solution for this.
THanks
kundan