posted 18 years ago
Hi
I have a POJO which returns a database connection.I have the following code in my class to get the connection.
Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY, "com.ibm.websphere.naming.WsnInitialContextFactory");
InitialContext initialContext = new InitialContext(env);
dataSource = (DataSource) initialcontext.lookup("jdbc/sqlserver_mydb");
[/code]
I have added references for this in the web.xml. I have added in the datasources also.
Once my server is running, I am trying to run my POJO as an application.
But this gives me a classcastexception: javax.naming.namingreference at
dataSource = (DataSource) initialcontext.lookup("jdbc/sqlserver_mydb");
It would be very helpful if someone could help me understand where i am going wrong.
thanks in advance
rgds
Mahesh