I have a program that will sometimes run in a j2ee container, in which case, I can add <env-entry> to my web.xml file.  I can then do a lookup of my properties.
 
Other times, I will call not have a j2ee container, and in  this case, I bring up the JDK jndi registry.  I have been able to add my datasource to this registry, but have not figured out how to add a String property.  Anyone ever do this, or have any ideas?
 
Thanks,
Phillip
 
 
For reference sake (this starts my jdk jndi registry)
 
 

System.setProperty("java.naming.factory.initial","com.sun.jndi.rmi.registry.RegistryContextFactory");

int port = 1099;
 java.rmi.registry.LocateRegistry.createRegistry(port);
    /*     This adds my datasource to JNDI
How do I add a env-entry for a String property????
*/
          Context ctx = new InitialContext();
          

          com.dumb.MyDatasource = new com.dumb.MyDatasource ();
          ds.setServerName("localhost");          
          ds.setPort(3306);
          ds.setDatabaseName("dummy");
          ctx.bind("jdbc/mydumbdb",ds);
 
 
 

Reply via email to