Java Code Examples for org.jeecg.common.system.vo.DynamicDataSourceModel#getDbUrl()
The following examples show how to use
org.jeecg.common.system.vo.DynamicDataSourceModel#getDbUrl() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DynamicDBUtil.java From teaching with Apache License 2.0 | 6 votes |
/** * 获取数据源【最底层方法,不要随便调用】 * * @param dbSource * @return */ @Deprecated private static BasicDataSource getJdbcDataSource(final DynamicDataSourceModel dbSource) { BasicDataSource dataSource = new BasicDataSource(); String driverClassName = dbSource.getDbDriver(); String url = dbSource.getDbUrl(); String dbUser = dbSource.getDbUsername(); String dbPassword = dbSource.getDbPassword(); //设置数据源的时候,要重新解密 // String dbPassword = PasswordUtil.decrypt(dbSource.getDbPassword(), dbSource.getDbUsername(), PasswordUtil.getStaticSalt());//解密字符串; dataSource.setDriverClassName(driverClassName); dataSource.setUrl(url); dataSource.setUsername(dbUser); dataSource.setPassword(dbPassword); return dataSource; }
Example 2
Source File: DynamicDBUtil.java From jeecg-cloud with Apache License 2.0 | 5 votes |
/** * 获取数据源【最底层方法,不要随便调用】 * * @param dbSource * @return */ private static DruidDataSource getJdbcDataSource(final DynamicDataSourceModel dbSource) { DruidDataSource dataSource = new DruidDataSource(); String driverClassName = dbSource.getDbDriver(); String url = dbSource.getDbUrl(); String dbUser = dbSource.getDbUsername(); String dbPassword = dbSource.getDbPassword(); dataSource.setDriverClassName(driverClassName); dataSource.setUrl(url); //dataSource.setValidationQuery("SELECT 1 FROM DUAL"); dataSource.setTestWhileIdle(true); dataSource.setTestOnBorrow(false); dataSource.setTestOnReturn(false); dataSource.setBreakAfterAcquireFailure(true); dataSource.setConnectionErrorRetryAttempts(0); dataSource.setUsername(dbUser); dataSource.setMaxWait(60000); dataSource.setPassword(dbPassword); log.info("******************************************"); log.info("* *"); log.info("*====【"+dbSource.getCode()+"】=====Druid连接池已启用 ====*"); log.info("* *"); log.info("******************************************"); return dataSource; }
Example 3
Source File: DynamicDBUtil.java From jeecg-boot with Apache License 2.0 | 5 votes |
/** * 获取数据源【最底层方法,不要随便调用】 * * @param dbSource * @return */ private static DruidDataSource getJdbcDataSource(final DynamicDataSourceModel dbSource) { DruidDataSource dataSource = new DruidDataSource(); String driverClassName = dbSource.getDbDriver(); String url = dbSource.getDbUrl(); String dbUser = dbSource.getDbUsername(); String dbPassword = dbSource.getDbPassword(); dataSource.setDriverClassName(driverClassName); dataSource.setUrl(url); //dataSource.setValidationQuery("SELECT 1 FROM DUAL"); dataSource.setTestWhileIdle(true); dataSource.setTestOnBorrow(false); dataSource.setTestOnReturn(false); dataSource.setBreakAfterAcquireFailure(true); dataSource.setConnectionErrorRetryAttempts(0); dataSource.setUsername(dbUser); dataSource.setMaxWait(60000); dataSource.setPassword(dbPassword); log.info("******************************************"); log.info("* *"); log.info("*====【"+dbSource.getCode()+"】=====Druid连接池已启用 ====*"); log.info("* *"); log.info("******************************************"); return dataSource; }