uPortal两种数据源:
1、JNDI 方式 根据portal.properties文件中的org.jasig.portal.RDBMServices.getDatasourceFromJndi参数来决定
org.jasig.portal.RDBMServices.PortalDatasourceJndiName指定默认数据名“PortalDb”
系统用ds = (DataSource)envCtx.lookup("jdbc/" + name);得到数据源然后加到map中去。
2、非JNDI方式(org.jasig.portal.RDBMServices.getDatasourceFromJndi指定为false)
系统会读取/properties/rdbm.properties文件
jdbcUsePool=true来设置是否使用连接池
portal.properties中的org.jasig.portal.PooledDataSourceFactory.implementation 指定数据源工厂
接口类为
public interface IPooledDataSourceFactory {
/**
* Creates a {@link DataSource} that is backed by a connection pool.
*
* @param driverClassName The class name of the jdbc driver to use.
* @param userName The username to connect to the database with.
* @param password The password to connect to the database with.
* @param url The url to locate the database with.
* @param maxActive Maximum number of dB connections in pool. Set to 0 for no limit.
* @param maxIdle Maximum number of idle dB connections to retain in pool. Set to 0 for no limit.
* @param maxWait Maximum time to wait for a dB connection to become available in ms, in this example 10 seconds. Set to -1 to wait indefinitely.
* @return A {@link DataSource} that is backed by a connection pool.
*/
public DataSource createPooledDataSource(String driverClassName, String userName, String password, String url);
}
本文介绍了uPortal系统中两种数据源配置方式:通过JNDI获取数据源和非JNDI方式使用连接池的数据源配置。对于非JNDI方式,详细说明了如何通过配置文件设置连接池的具体参数。
1961

被折叠的 条评论
为什么被折叠?



