public void bind(String name, DataSource dataSource) throws NamingException {
        if (name == null) {
            throw new IllegalArgumentException("name cannot be null");
        }
        if (dataSource == null) {
            throw new IllegalArgumentException("dataSource cannot be null");
        }

        String jndiUrl = "java:/comp/env/jdbc/" + name;
        initialContext.bind(jndiUrl, dataSource);
        this.dataSourceBindings.put(dataSource, jndiUrl);
    }
public void bind ( String name , DataSource dataSource ) throws NamingException { if ( name == null ) { throw new IllegalArgumentException ( "name cannot be null" ) ; } if ( dataSource == null ) { throw new IllegalArgumentException ( "dataSource cannot be null" ) ; } String jndiUrl = "java:/comp/env/jdbc/" + name ; initialContext . bind ( jndiUrl , dataSource ) ; this . dataSourceBindings . put ( dataSource , jndiUrl ) ; }
Binds a data source to a name. The given name will be prepended with
<code>java:/comp/env/jdbc/</code>.

@param name the name to which to bind the given data source.
@param dataSource a {@link DataSource}.
@throws NamingException if an error occurs during binding.