what would be java.naming.provider.url for tomcat -


I am trying to get a database connection from a tomcat server using JMDI. In that case what would be my java.naming.provider.url in case of tomatoes ??

The question is not very clear per JNDI, the URL property specifies the location of the registry in rmi: / / Server: port At least when you are creating binding naming contexts for initially registered objects in the registry, you must pass in the registry place. You can get sample code:

  // Registry service provider as the initial reference env.put (Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.rmi.registry. RegistryContextFactory "); // Specify that the registry is running env.put (references PROVIDER_URL, "rmi: // server: 1099"); // Create an initial reference that reaches the Registry Reference CTX = New Initial Context (NV); // Now, the names stored in the registry can be listed naming anman = ctx.list ("");    

Comments