Hai ,,
please help me..i m using JNDI connection.. its working fine
this is working for inserting some records.. after some time i got the exception like this. i m new to this. plz help me
javax.naming.NameNotFoundException: Name
java: is not bound in this Context
at org.apache.naming.NamingContext.lookup(NamingContext.java:768)
at org.apache.naming.NamingContext.lookup(NamingContext.java:151)
at org.apache.naming.SelectorContext.lookup(SelectorContext.java:136)
my connection code is :..
private static Context ctx;
public static java.sql.Connection getDBConnection() {
DataSource ds;
java.sql.Connection con;
try {
if(ctx==null) ctx=new InitialContext();
ds=(DataSource)ctx.lookup(InfrastructureLayer.DATASOURCENAME);
con=ds.getConnection();
} catch(NamingException ne) {
log("InfrastructureLayer.getConnection(): ERROR: Aborting file processing. while processing header thrown NamingException:"+ne);
ne.printStackTrace();
return null;
} catch(SQLException sqle) {
log("InfrastructureLayer.getConnection(): ERROR: Aborting file processing. while processing header thrown SQLException:"+sqle);
sqle.printStackTrace();
return null;
}
return con;
}