Lookup from Standalone Client
By shalini_m on Oct 26, 2007
My previous blog was about accessing a JDBC resource from an ejb.
This blog talks about accessing the JDBC resource i created in the last blog, from a standalone client.
I use the same configuration from my previous blog : jdbc/cactus for my resource that needs to be accessed.
My sample will have the following code:
InitialContext ctx = new InitialContext();
javax.sql.DataSource ds = (javax.sql.DataSource) ctx.lookup("jdbc/cactus"
Connection c = ds.getConnection();
Compile the sample
Run the sample
Note the included jars in the classpath
Also, observe the system properties for the server host and naming service port.