本文整理汇总了Java中com.mysql.jdbc.jdbc2.optional.MysqlDataSource.setPortNumber方法的典型用法代码示例。如果您正苦于以下问题:Java MysqlDataSource.setPortNumber方法的具体用法?Java MysqlDataSource.setPortNumber怎么用?Java MysqlDataSource.setPortNumber使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.mysql.jdbc.jdbc2.optional.MysqlDataSource
的用法示例。
在下文中一共展示了MysqlDataSource.setPortNumber方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: prepareMySQL
import com.mysql.jdbc.jdbc2.optional.MysqlDataSource; //导入方法依赖的package包/类
private static DataSource prepareMySQL(final Settings settings) {
try {
final MysqlDataSource dataSource = new MysqlDataSource();
dataSource.setServerName(settings.readDatabaseHost());
dataSource.setPortNumber(Integer.parseInt(settings.readDatabasePort()));
dataSource.setDatabaseName(settings.readDatabaseName());
dataSource.setUser(settings.readDatabaseUsername());
dataSource.setPassword(settings.readDatabasePassword());
return dataSource;
} catch (SecurityException e) {
throw new LeargasException(e.getMessage(), e);
}
}
示例2: CMySQLDataStore
import com.mysql.jdbc.jdbc2.optional.MysqlDataSource; //导入方法依赖的package包/类
/**
* Uses JDBC connection pooling to initialise data source
*/
public CMySQLDataStore(String Sname, int Pnumber, String User, String Pwd, String dbName) {
MysqlDataSource objDs = new MysqlDataSource();
objDs.setServerName(Sname);
objDs.setPortNumber(Pnumber);
objDs.setUser(User);
objDs.setPassword(Pwd);
objDs.setDatabaseName(dbName);
ds = objDs;
}
示例3: createDataSource
import com.mysql.jdbc.jdbc2.optional.MysqlDataSource; //导入方法依赖的package包/类
private DataSource createDataSource() {
final MysqlDataSource ds = new MysqlDataSource();
ds.setServerName("localhost");
ds.setPortNumber(3306);
ds.setDatabaseName("killbill");
ds.setUser("root");
ds.setPassword("root");
return ds;
}
示例4: createTestDataAccessProvider
import com.mysql.jdbc.jdbc2.optional.MysqlDataSource; //导入方法依赖的package包/类
private static DataAccessProvider createTestDataAccessProvider() {
MysqlDataSource dataSource = new MysqlDataSource();
dataSource.setServerName("localhost");
dataSource.setPortNumber(3306);
dataSource.setDatabaseName("degagetest");
dataSource.setUser("degage");
dataSource.setPassword("DeGaGe");
return new JDBCDataAccessProvider(true, dataSource);
}
示例5: setup
import com.mysql.jdbc.jdbc2.optional.MysqlDataSource; //导入方法依赖的package包/类
private void setup(final MysqlDataSource inSource,
final Properties inProperties) {
if (inProperties == null) {
return;
}
if (inProperties.containsKey(JDBC_DATABASE_NAME)) {
inSource.setDatabaseName(inProperties
.getProperty(JDBC_DATABASE_NAME));
}
if (inProperties.containsKey(JDBC_DATASOURCE_NAME)) {
// not supported?
}
if (inProperties.containsKey(JDBC_DESCRIPTION)) {
// not supported?
}
if (inProperties.containsKey(JDBC_NETWORK_PROTOCOL)) {
// not supported?
}
if (inProperties.containsKey(JDBC_PASSWORD)) {
inSource.setPassword(inProperties.getProperty(JDBC_PASSWORD));
}
if (inProperties.containsKey(JDBC_PORT_NUMBER)) {
inSource.setPortNumber(Integer.parseInt(inProperties
.getProperty(JDBC_PORT_NUMBER)));
}
if (inProperties.containsKey(JDBC_ROLE_NAME)) {
// not supported?
}
if (inProperties.containsKey(JDBC_SERVER_NAME)) {
inSource.setServerName(inProperties.getProperty(JDBC_SERVER_NAME));
}
if (inProperties.containsKey(JDBC_URL)) {
inSource.setURL(inProperties.getProperty(JDBC_URL));
}
if (inProperties.containsKey(JDBC_USER)) {
inSource.setUser(inProperties.getProperty(JDBC_USER));
}
}
示例6: CMySQLDataStore
import com.mysql.jdbc.jdbc2.optional.MysqlDataSource; //导入方法依赖的package包/类
/**
* Uses JDBC connection pooling to initialise data source
*/
public CMySQLDataStore(String Sname, int Pnumber) {
MysqlDataSource objDs = new MysqlDataSource();
objDs.setServerName(Sname);
objDs.setPortNumber(Pnumber);
objDs.setUser(CSettingManager.getSetting("DB_User"));
objDs.setPassword(CSettingManager.getSetting("DB_Pwd"));
objDs.setDatabaseName(CSettingManager.getSetting("DB_Database"));
ds = objDs;
}