Context context = null;
try {
Properties properties = new Properties();
properties.setProperty(
Context.INITIAL_CONTEXT_FACTORY,
"com.sun.jndi.fscontext.RefFSContextFactory");
properties.setProperty(
Context.PROVIDER_URL,
"file:/JNDI/JDBC");
context = new InitialContext(properties);
}
catch (NamingException ne) {
System.err.println(ne.getMessage());
}
OracleConnectionPoolDataSource ocpds =
new OracleConnectionPoolDataSource();
ocpds.setDescription("Database");
ocpds.setDriverType("thin");
ocpds.setServerName("dssw2k01");
ocpds.setPortNumber(1521);
ocpds.setDatabaseName("orcl");
ocpds.setUser("scott");
ocpds.setPassword("tiger");
context.bind(ocpds.getDescription(), ocpds);