Hi Thank you for reading my post. Imagine that i have a jndi datasource like : java:comp/env/jdbc/be now i want to creat a connection from this datasource , how i can do that ? can you please give me the steps ? I want to do it in a servlet.
Raminaa, 1) Create an initial context. Likely this is as simple as: InitialContext ctx = new InitialContext(), but it depends on your app server. 2) Get the datasource from the initial context. - lookup by JNDI name 3) Get a connection from the datasource. - getConnection() method.