本文整理汇总了Java中oracle.jdbc.pool.OracleDataSource.setServerName方法的典型用法代码示例。如果您正苦于以下问题:Java OracleDataSource.setServerName方法的具体用法?Java OracleDataSource.setServerName怎么用?Java OracleDataSource.setServerName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类oracle.jdbc.pool.OracleDataSource
的用法示例。
在下文中一共展示了OracleDataSource.setServerName方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initialSetup
import oracle.jdbc.pool.OracleDataSource; //导入方法依赖的package包/类
public void initialSetup(String rootUser, String rootPass, String rootDb)
{
try
{
// Set up the root connection
OracleDataSource oracleRootSource = new OracleDataSource();
oracleRootSource.setServerName(DatabaseProperties.getServerName());
oracleRootSource.setServiceName(rootDb);
oracleRootSource.setPortNumber(DatabaseProperties.getPort());
oracleRootSource.setDriverType("thin");
oracleRootSource.setUser(rootUser);
oracleRootSource.setPassword(rootPass);
this.rootDataSource = oracleRootSource;
}
catch (SQLException e)
{
throwDatabaseException(e);
}
this.dropUser();
this.createUser();
}
示例2: createConnection
import oracle.jdbc.pool.OracleDataSource; //导入方法依赖的package包/类
public static Connection createConnection() throws SQLException {
MjdbcUtils.loadDriver("oracle.jdbc.pool.OracleDataSource");
OracleDataSource ds = new oracle.jdbc.pool.OracleDataSource();
ds.setDriverType("thin");
ds.setServerName("localhost");
ds.setDatabaseName("xe");
ds.setPortNumber(1521);
ds.setUser("chris");
ds.setPassword("welcome1");
Connection conn = ds.getConnection();
return conn;
}
示例3: CommittingData
import oracle.jdbc.pool.OracleDataSource; //导入方法依赖的package包/类
/**
* Constructs a CommittingData object.
* @throws SQLException Any database error while
* opening a database connection
*/
public CommittingData() throws SQLException {
OracleDataSource ods = new OracleDataSource();
ods.setDriverType("thin");
ods.setServerName(host);
ods.setPortNumber(port);
ods.setServiceName(serviceName);
ods.setUser(userName);
ods.setPassword(password);
myConnection = ods.getConnection();
myConnection.setAutoCommit(false);
}
示例4: dataSource
import oracle.jdbc.pool.OracleDataSource; //导入方法依赖的package包/类
@Bean(name = "sampledb")
public DataSource dataSource() throws SQLException {
OracleDataSource d = new OracleDataSource();
d.setServerName(host);
d.setDatabaseName(databaseName);
d.setPortNumber(portNumber);
d.setUser(user);
d.setPassword(password);
return d;
}