技术开发 频道

使Domino支持连接池技术

    【IT168 技术文章】

    Domino支持连接池吗?不支持,Domino本身并不支持连接池技术。那么怎么能让它支持连接池那?

    这个问题终于有了答案。可以使用第三方的jndi server,比如jboss的jnpserver,在jnpserver中注册数据源,然后在java代理中取数据源即可。

    unpooled = DataSources.unpooledDataSource("jdbc:oracle:thin:@192.168.0.1:1521:devuser", "admin", "password");

    pooled = DataSources.pooledDataSource(unpooled);

    Properties env = new Properties();

    env.load(new FileInputStream("jndi.properties"));

    env.list(System.out);

    System.out.println("starting jnpserver...");

    jnpserver = new Main();

    jnpserver.start();


    NamingServer name = (NamingServer)jnpserver.getServer();

    //Bind DataSource

    InitialContext ctx = new InitialContext(env);


    System.out.println("Binding PooledDataSource.");

    ctx.bind("Naming", pooled);

    在代理中的代码:

    InitialContext ctx = new InitialContext();

    DataSource ds = (DataSource) ctx.lookup("Naming");

    conn = ds.getConnection();
 

0
相关文章