当前位置: 首页>>代码示例>>Java>>正文


Java OracleDataSource.setURL方法代码示例

本文整理汇总了Java中oracle.jdbc.pool.OracleDataSource.setURL方法的典型用法代码示例。如果您正苦于以下问题:Java OracleDataSource.setURL方法的具体用法?Java OracleDataSource.setURL怎么用?Java OracleDataSource.setURL使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在oracle.jdbc.pool.OracleDataSource的用法示例。


在下文中一共展示了OracleDataSource.setURL方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createConnectionPool

import oracle.jdbc.pool.OracleDataSource; //导入方法依赖的package包/类
/**
 * Creates a database connection pool object using JDBC 2.0.
 */
private OracleDataSource createConnectionPool() {
  try {
    // Create a OracleConnectionPoolDataSource instance.
    OracleDataSource ds = new OracleDataSource();
    ds.setConnectionCacheName("oraCache");
    ds.setConnectionCachingEnabled(true);
    ds.setURL(TestConfig.tab().stringAt(JtaPrms.jdbcUrl));
    ds.setUser(TestConfig.tab().stringAt(JtaPrms.rdbUser));
    ds.setPassword(TestConfig.tab().stringAt(JtaPrms.rdbPassword));

    Properties cacheProps = new Properties();
    cacheProps.setProperty("MinLimit",
        String.valueOf(TestConfig.tab().intAt(JtaPrms.poolMinLimit)));
    ds.setConnectionCacheProperties(cacheProps);
    return ds;
  } catch (Exception ex) {
    Log.getLogWriter().info("Unable to create connection pool: " + ex, ex);
    throw new HydraRuntimeException("Problem creating Oracle connection pool", ex);
  }
}
 
开发者ID:gemxd,项目名称:gemfirexd-oss,代码行数:24,代码来源:DBUtil.java

示例2: generate

import oracle.jdbc.pool.OracleDataSource; //导入方法依赖的package包/类
public void generate(Settings settings) {
    try {
        OracleDataSource oracleDataSource = new OracleDataSource();
        oracleDataSource.setURL(settings.getJdbcUrl());
        TypeCatalogDAO typeCatalogDAO = new TypeCatalogDAO(oracleDataSource);

        List<String> types = typeCatalogDAO.getTypeList();

        for (String typeName : types) {
            List<TypeAttribute> typeAttributes = typeCatalogDAO.getTypeAttributes(typeName);

            String className = StringHelper.toCamelCase(typeName);
            VelocityRenderer velocityRenderer = new VelocityRenderer("typepojo.vm");

            velocityRenderer.put("className", className);
            velocityRenderer.put("targetPackage", settings.getEntityPackageName());
            velocityRenderer.put("attrList", typeAttributes);

            FileUtils.writeStringToFile(new File(settings.getBasePath() + "/" + settings.getEntityPackageName().replace(".", "/") + "/" + className + ".java"), velocityRenderer.render());

        }

    } catch (Exception e) {
        throw new RuntimeException(e);
    }
}
 
开发者ID:karsany,项目名称:plsql-from-java-maven-plugin,代码行数:27,代码来源:ObjectTypeGenerator.java

示例3: privilegedBankDataSource

import oracle.jdbc.pool.OracleDataSource; //导入方法依赖的package包/类
@Bean
PrivilegedDataSourceProvider privilegedBankDataSource() throws SQLException {
    OracleDataSource dataSource = new OracleDataSource();
    dataSource.setUser("system");
    dataSource.setPassword("oracle");
    dataSource.setURL("jdbc:oracle:thin:@//localhost:1521/XE");

    return DefaultPrivilegedDataSourceProvider.builder()
        .dataSourceName("dataSource")
        .privilegedDataSource(dataSource)
        .schemas(Arrays.asList("BANK"))
        .build();
}
 
开发者ID:EmbedITCZ,项目名称:dbadvisor,代码行数:14,代码来源:AbstractIT.java

示例4: Create

import oracle.jdbc.pool.OracleDataSource; //导入方法依赖的package包/类
/**
 * Creates a connection to an oracle database
 * @param username A username, e.g. "DB_USER"
 * @param password A password, e.g. "rainbow123"
 * @param connectionString A connection string, e.g. "jdbc:oracle:thin:@sdwh.cooperation.net:1331:SDWH"
 * @param log Object for accessing the console
 * @return a Connection object
 * @throws SQLException
 */
public static Connection Create(String username, String password, String connectionString, Log log) throws SQLException {
    PingPong ping = log.info("connecting to database...");
    OracleDataSource ods = new OracleDataSource();
    ods.setUser(username);
    ods.setPassword(password);
    ods.setURL(connectionString);
    log.finished(ping);
    return ods.getConnection();
}
 
开发者ID:BernhardSchlegel,项目名称:SQL-dumper,代码行数:19,代码来源:OracleConnection.java

示例5: dataSource

import oracle.jdbc.pool.OracleDataSource; //导入方法依赖的package包/类
@Bean
public OracleDataSource dataSource() throws SQLException {
	OracleDataSource ds = new OracleDataSource();
	ds.setURL(WqpEnv.get("test.datasource.url"));
	ds.setUser(WqpEnv.get("test.datasource.username"));
	ds.setPassword(WqpEnv.get("test.datasource.password"));
	return ds;
}
 
开发者ID:NWQMC,项目名称:WQP-WQX-Services,代码行数:9,代码来源:TestSpringConfig.java

示例6: dbUnitDataSource

import oracle.jdbc.pool.OracleDataSource; //导入方法依赖的package包/类
@Bean
public OracleDataSource dbUnitDataSource() throws SQLException {
	OracleDataSource ds = new OracleDataSource();
	ds.setURL(WqpEnv.get("test.datasource.url"));
	ds.setUser(WqpEnv.get("test.dbunit.username"));
	ds.setPassword(WqpEnv.get("test.dbunit.password"));
	return ds;
}
 
开发者ID:NWQMC,项目名称:WQP-WQX-Services,代码行数:9,代码来源:TestSpringConfig.java

示例7: ScriptRunner

import oracle.jdbc.pool.OracleDataSource; //导入方法依赖的package包/类
public ScriptRunner(final String jdbcUrl, final String username, final String password) throws SQLException {
  OracleDataSource ds = new OracleDataSource();
  ds.setURL(jdbcUrl);
  ds.setUser(username);
  ds.setPassword(password);
  this.dataSource = ds;
}
 
开发者ID:codemumbler,项目名称:mdb-oracle,代码行数:8,代码来源:ScriptRunner.java

示例8: StartConnection

import oracle.jdbc.pool.OracleDataSource; //导入方法依赖的package包/类
private void StartConnection() {
	try {
		Locale.setDefault(new Locale(stringConnection.language(), stringConnection.country()));
		OracleDataSource ods = new OracleDataSource();
		ods.setURL("jdbc:oracle:thin:@" + stringConnection.host() + ":" + stringConnection.port() + ":" + stringConnection.database());
		ods.setUser(stringConnection.user());
		ods.setPassword(stringConnection.password());
		connection = ods.getConnection();
		connection.setAutoCommit(stringConnection.autoCommit());
	} catch (SQLException e) {
		System.out.println("Could not connect - StartConnection (). Let's try again!");
		e.printStackTrace();
		StartConnection();
	}
}
 
开发者ID:miamarti,项目名称:HorusFramework,代码行数:16,代码来源:HorusOracleDriveConnection.java

示例9: generate

import oracle.jdbc.pool.OracleDataSource; //导入方法依赖的package包/类
public void generate(Settings settings) {
    try {
        OracleDataSource oracleDataSource = new OracleDataSource();
        oracleDataSource.setURL(settings.getJdbcUrl());

        ProcedureCatalogDAO procedureCatalogDAO = new ProcedureCatalogDAO(oracleDataSource);

        List<Procedure> allProcedures = procedureCatalogDAO.getAllProcedures("");

        for (Procedure p : allProcedures) {

            List<ProcedureArgument> procedureArguments = procedureCatalogDAO.getProcedureArguments(p.getObjectName(), p.getProcedureName(), p.getOverload());

            String className = StringHelper.toCamelCase(p.getObjectName() + "_" + p.getProcedureName() + "_" + p.getOverload());
            VelocityRenderer velocityRenderer = new VelocityRenderer("sppojo.vm");

            velocityRenderer.put("className", className);
            velocityRenderer.put("procedure", p);
            velocityRenderer.put("procedureName", p.getObjectName() + "." + p.getProcedureName());
            velocityRenderer.put("targetPackage", settings.getProcedurePackageName());
            velocityRenderer.put("par", procedureArguments);
            velocityRenderer.put("modelPackage", settings.getEntityPackageName());
            velocityRenderer.put("converterPackage", settings.getConverterPackageName());
            velocityRenderer.put("utilPackage", settings.getUtilPackageName());

            FileUtils.writeStringToFile(new File(settings.getBasePath() + "/" + settings.getProcedurePackageName().replace(".", "/") + "/" + className + ".java"), velocityRenderer.render());

        }

    } catch (Exception e) {
        throw new RuntimeException(e);
    }
}
 
开发者ID:karsany,项目名称:plsql-from-java-maven-plugin,代码行数:34,代码来源:ProcedureGenerator.java

示例10: generate

import oracle.jdbc.pool.OracleDataSource; //导入方法依赖的package包/类
public void generate(Settings settings) {
    try {
        OracleDataSource oracleDataSource = new OracleDataSource();
        oracleDataSource.setURL(settings.getJdbcUrl());

        List<String> servicePackages = new ServiceCatalogDAO(oracleDataSource).getServicePackages();

        for (String s : servicePackages) {

            List<Procedure> packageServiceProcedures = new ServiceCatalogDAO(oracleDataSource).getPackageServiceProcedures(s);

            VelocityRenderer velocityRenderer = new VelocityRenderer("serviceclass.vm");

            String className = StringHelper.toCamelCase(s);

            System.out.println(className);

            velocityRenderer.put("className", className);
            velocityRenderer.put("service", packageServiceProcedures);
            velocityRenderer.put("servicePackage", settings.getServicePackageName());
            velocityRenderer.put("modelPackage", settings.getEntityPackageName());
            velocityRenderer.put("utilPackage", settings.getUtilPackageName());
            velocityRenderer.put("procPackage", settings.getProcedurePackageName());
            FileUtils.writeStringToFile(new File(settings.getBasePath() + "/" + settings.getServicePackageName().replace(".", "/") + "/" + className + ".java"), velocityRenderer.render());

        }

    } catch (Exception e) {
        throw new RuntimeException(e);
    }
}
 
开发者ID:karsany,项目名称:plsql-from-java-maven-plugin,代码行数:32,代码来源:ServiceGenerator.java

示例11: generate

import oracle.jdbc.pool.OracleDataSource; //导入方法依赖的package包/类
public void generate(Settings settings) {
    try {
        OracleDataSource oracleDataSource = new OracleDataSource();
        oracleDataSource.setURL(settings.getJdbcUrl());
        TypeCatalogDAO typeCatalogDAO = new TypeCatalogDAO(oracleDataSource);

        List<String> types = typeCatalogDAO.getTypeList();

        for (String typeName : types) {
            List<TypeAttribute> typeAttributes = typeCatalogDAO.getTypeAttributes(typeName);

            String className = StringHelper.toCamelCase(typeName);
            String smallClassName = StringHelper.toCamelCaseSmallBegin(typeName);
            VelocityRenderer velocityRenderer = new VelocityRenderer("typegenerator.vm");

            velocityRenderer.put("className", className);
            velocityRenderer.put("smallClassName", smallClassName);
            velocityRenderer.put("typeName", typeName);
            velocityRenderer.put("targetPackage", settings.getConverterPackageName());
            velocityRenderer.put("attrList", typeAttributes);
            velocityRenderer.put("oracleTypesPackage", settings.getEntityPackageName());

            FileUtils.writeStringToFile(new File(settings.getBasePath() + "/" + settings.getConverterPackageName().replace(".", "/") + "/" + className + "Converter.java"), velocityRenderer.render());


        }

    } catch (Exception e) {
        throw new RuntimeException(e);

    }
}
 
开发者ID:karsany,项目名称:plsql-from-java-maven-plugin,代码行数:33,代码来源:ObjectTypeConverterGenerator.java

示例12: createDataSource

import oracle.jdbc.pool.OracleDataSource; //导入方法依赖的package包/类
protected DataSource createDataSource() {
	try {
		OracleDataSource source = new OracleDataSource();
		source.setUser(USER);
		source.setPassword(PASS);
		source.setURL(getDataSourceURL());		
		return source;
	} catch (SQLException e) {
		logger.error("Error while creating datasource for oracle", e);
		fireRepositoryEvent(EventLevel.ERROR, "Error while creating datasource for oracle", e);
	}
    return null;
}
 
开发者ID:opencanarias,项目名称:model-repository-benchmark,代码行数:14,代码来源:JVMOracleCDOModelRepository.java

示例13: Database

import oracle.jdbc.pool.OracleDataSource; //导入方法依赖的package包/类
private Database() {
	try {
		ods = new OracleDataSource();
		ods.setURL(ApplicationConfig.DB_CONNECTION);
		ods.setUser(ApplicationConfig.DB_USER);
		ods.setPassword(ApplicationConfig.DB_PASSWORD);

		// Load driver
		Class.forName(ApplicationConfig.JDBC_CLASS);
	} catch (SQLException e1) {
		LOG.warn("Connection failed!");
	} catch (ClassNotFoundException e) {
		LOG.warn("Driver not found!");
	}
}
 
开发者ID:gausss,项目名称:MuSe,代码行数:16,代码来源:Database.java

示例14: createDefaultDataSource

import oracle.jdbc.pool.OracleDataSource; //导入方法依赖的package包/类
protected DataSource createDefaultDataSource()
        throws Exception
{
    OracleDataSource unitDataSource = new OracleDataSource();

    String url = propertyManager.getUnitDataSourceURL();
    String user = propertyManager.getUnitDataSourceUser();
    String password = propertyManager.getUnitDataSourcePassword();

    unitDataSource.setURL(url);
    unitDataSource.setUser(user);
    unitDataSource.setPassword(password);

    return unitDataSource;
}
 
开发者ID:NCIP,项目名称:cadsr-semantic-tools,代码行数:16,代码来源:MainTestCase.java


注:本文中的oracle.jdbc.pool.OracleDataSource.setURL方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。