这是用来做什么的?没涉及过,
//我在tomcat5中创建了一个JDBC连接的数据源jdbc/test
不好意思,怎么创建的?

解决方案 »

  1.   

    tomcat的程序是什么意思
    是指放在tomcat里面的网页jsp和servlet?
      

  2.   

    tomcat5没这样吧,jboss 里客户端要加的
      

  3.   

    你这种情况一般是不太可能发生的
    tomcat或者其它服务器的连接池,你怎么能在其他地方使用呢?
    他的连接池实现是以来这个容器的,以来容器的很多jar实现,所以离开这个环境你是不可能初始化上下文环境的
      

  4.   

    以weblogic为例,tomcat必需如此。如果不是在当前应用服务环境中,以下参数必需指定String url = "t3://localhost:80";
    String user = null;
    String password = null;
    Properties properties = null;
    try {
    properties = new Properties();
            properties.put(Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory");
            properties.put(Context.PROVIDER_URL, url);
            if (user != null) {
                properties.put(Context.SECURITY_PRINCIPAL, user);
                properties.put(Context.SECURITY_CREDENTIALS, password == null ? "" : password);
            }
            return new InitialContext(properties);
    }
    catch (Exception e) {
        throw e;
    }