com.mysql.jdbc.jdbc2.optional.MysqlDataSource.setPort()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(3.9k)|赞(0)|评价(0)|浏览(111)

本文整理了Java中com.mysql.jdbc.jdbc2.optional.MysqlDataSource.setPort()方法的一些代码示例,展示了MysqlDataSource.setPort()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。MysqlDataSource.setPort()方法的具体详情如下:
包路径:com.mysql.jdbc.jdbc2.optional.MysqlDataSource
类名称:MysqlDataSource
方法名:setPort

MysqlDataSource.setPort介绍

暂无

代码示例

代码示例来源:origin: alibaba/nacos

dataSource.setPort(ip.getPort());

代码示例来源:origin: killbill/killbill

private DataSource getRawMysqlDataSource(final String dbName, final String user, final String pwd) {
  final com.mysql.jdbc.jdbc2.optional.MysqlDataSource rawSource = new com.mysql.jdbc.jdbc2.optional.MysqlDataSource();
  rawSource.setDatabaseName(dbName);
  rawSource.setUser(user);
  rawSource.setPassword(pwd);
  rawSource.setPort(3306);
  rawSource.setURL("jdbc:mysql://localhost:3306/killbill?createDatabaseIfNotExist=true&allowMultiQueries=true");
  return rawSource;
}

代码示例来源:origin: stackoverflow.com

import com.mysql.jdbc.jdbc2.optional.MysqlDataSource;

public class SignalDB {

  private static MysqlDataSource ds = null;

  public static MysqlDataSource getDataSource(String db_name) {
    if (ds == null) {
      // db variables set here
      getDataSource(db_url, db_user, db_password, db_port);
    }
    ds.setDatabaseName(db_name);
    return ds;
  }

  private static void getDataSource(String db_url, String db_user, String db_password, int db_port) {
    try {
      ds = new MysqlDataSource();
      ds.setServerName(db_url);
      ds.setUser(db_user);
      ds.setPassword(db_password);
      ds.setPort(db_port);
    } catch (Exception e) {
      System.out.println("MysqlDataSource err: " + e.getMessage());
      e.printStackTrace();
    }
  }
}

代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-analytics

@Override
public void initialize() throws IOException {
  dataSource = new MysqlDataSource();
  dataSource.setDatabaseName(databaseName);
  dataSource.setUser(username);
  dataSource.setPassword(password);
  dataSource.setPort(port);
  // See http://dev.mysql.com/doc/refman/5.0/en/connector-j-reference-configuration-properties.html
  dataSource.setURL(jdbcConnectionString);
}

代码示例来源:origin: com.ning.billing.commons/killbill-embeddeddb

@Override
public void initialize() throws IOException {
  dataSource = new MysqlDataSource();
  dataSource.setDatabaseName(databaseName);
  dataSource.setUser(username);
  dataSource.setPassword(password);
  dataSource.setPort(port);
  // See http://dev.mysql.com/doc/refman/5.0/en/connector-j-reference-configuration-properties.html
  dataSource.setURL(jdbcConnectionString);
}

代码示例来源:origin: games647/LagMonitor

public Storage(Logger logger, String host, int port, String database, boolean usessl, String user, String pass, String prefix) {
  this.logger = logger;
  this.prefix = prefix;
  this.dataSource = new MysqlDataSource();
  this.dataSource.setUser(user);
  this.dataSource.setPassword(pass);
  this.dataSource.setServerName(host);
  this.dataSource.setPort(port);
  this.dataSource.setDatabaseName(database);
  this.dataSource.setUseSSL(usessl);
}

代码示例来源:origin: stackoverflow.com

MysqlDataSource ds = new MysqlDataSource();
ds.setDatabaseName("DATABASE");
ds.setUser("USERNAME");
ds.setPassword("USER PASSWORD");
ds.setServerName("localhost");
ds.setPort(3306);
connection = ds.getConnection();

代码示例来源:origin: stackoverflow.com

MysqlDataSource ds = new MysqlDataSource();
ds.setServerName("localhost");
ds.setPort("3306");
ds.setDatabaseName("testdb");
ds.setUser("root");
ds.setPassword("");
Connection connection = ds.getConnection();

代码示例来源:origin: org.kill-bill.billing/killbill-util

private DataSource getRawMysqlDataSource(final String dbName, final String user, final String pwd) {
  final com.mysql.jdbc.jdbc2.optional.MysqlDataSource rawSource = new com.mysql.jdbc.jdbc2.optional.MysqlDataSource();
  rawSource.setDatabaseName(dbName);
  rawSource.setUser(user);
  rawSource.setPassword(pwd);
  rawSource.setPort(3306);
  rawSource.setURL("jdbc:mysql://localhost:3306/killbill?createDatabaseIfNotExist=true&allowMultiQueries=true");
  return rawSource;
}

代码示例来源:origin: stackoverflow.com

mysqlDS.setPort(3306);
mysqlDS.setDatabaseName("databasename");

相关文章