Hi i am trying to open a database connection using JDO(JNDI lookup).I am getting the following error.
 
java.lang.ClassCastException
 
I am using the code below.
 
InitialContext  ctx;
Database        db;
ctx = new InitialContext();
db = (Database) ctx.lookup( "java:comp/env/jdbc/UCCNETAPP" );
 
 
I have the code below which works fine but not using JDO.
 
tyrex.jdbc.xa.EnabledDataSource dataSource = null;
Connection conn = null;
 
 
Context initCtx = new InitialContext();
Context envCtx = (Context) initCtx.lookup("java:comp/env");
dataSource = (tyrex.jdbc.xa.EnabledDataSource)envCtx.lookup("jdbc/UCCNETAPP");
conn = dataSource.getConnection();
 
 
I am trying to run the code on Tomcat server.Looking forward for assistance in resolving the above said error.
 
Thanks
Pradeep
 

Reply via email to