Hi
I am developing a WebService using Java (JAX-RPC).
According to the requirement, I have to create a Thread to
insert data into Database.
So I am opening a database connection in the following way:
Note: I am using runnable interface and I am calling the getCon() from run method.
But I am getting the following error message:
" javax.naming.Na meNotFoundExcep tion:
Name comp/env/jdbc not found in context "java:"."
From this point of view, my child thread is failing to open DB connection.
Is there way to open database connection using a child thread in web container like WebSphere?
I am developing a WebService using Java (JAX-RPC).
According to the requirement, I have to create a Thread to
insert data into Database.
So I am opening a database connection in the following way:
Note: I am using runnable interface and I am calling the getCon() from run method.
Code:
public Connection getCon(){
ctx = new javax.naming.InitialContext();
ds = (javax.sql.DataSource) ctx.lookup("java:comp/env/JNDINAME"); //JNDI NAME: jdbc/Sample
con = ds.getConnection();
con.setAutoCommit(true);
return con;
}
" javax.naming.Na meNotFoundExcep tion:
Name comp/env/jdbc not found in context "java:"."
From this point of view, my child thread is failing to open DB connection.
Is there way to open database connection using a child thread in web container like WebSphere?
Comment