tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Harry Levinson" <>
Subject read context.xml Resource attributes
Date Fri, 24 Oct 2008 01:20:09 GMT
What is the proper way to read attributes of a Resource in context.xml, for
example the "url" attribute?

I am building a test web page that shows whether or not we are successfully
connected to the database. Only techies inide the company will be able to
view that web page, so security is not an issue. (I will not display
username/password anyway.)

I want to retrieve and display the url attribute for a specified Resource in

I know I can use XML functions to read the file, but is there a way to read
it using envContext() or something like that, after I create a Connection or
Context object?

Here are two different scenarios that begin the section of code I'm looking

    Connection conn = connections.get(dataSource);

    Context initContext = new InitialContext();
    Context envContext = (Context)initContext.lookup("java:/comp/env");
    DataSource ds = (DataSource)envContext.lookup("jdbc/MYDB");

I googled but can't find a solution.


  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message