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

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

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

MysqlDataSource.setPassword介绍

暂无

代码示例

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

MysqlDataSource dataSource = new MysqlDataSource();
dataSource.setUser("scott");
dataSource.setPassword("tiger");
dataSource.setServerName("myDBHost.example.org");

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

dataSource.setSocketTimeout(CONNECT_TIMEOUT_MS);
dataSource.setUser(config.getUser());
dataSource.setPassword(config.getPwd());
dataSource.setLoginTimeout(1);

代码示例来源: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

MysqlDataSource ds = new MysqlDataSource();
ds.setServerName("host");
ds.setUser("user");
ds.setPassword("password");

JdbcTemplate jdbcTemplate = new JdbcTemplate(ds);

BufferedReader in = new BufferedReader(new FileReader("script.sql"));
LineNumberReader fileReader = new LineNumberReader(in);
String query = JdbcTestUtils.readScript(fileReader);

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

MysqlDataSource ds = new MysqlDataSource();
ds.setServerName("hostname");
ds.setUser("username");
ds.setPassword("password");

JdbcTemplate jdbcTemplate = new JdbcTemplate(ds);

BufferedReader in = new BufferedReader(new FileReader("script.sql"));
LineNumberReader fileReader = new LineNumberReader(in); 
String query = JdbcTestUtils.readScript(fileReader);

代码示例来源:origin: jerolba/jfleet

@Override
public DataSource get() {
  MysqlDataSource mysqlds = new MysqlDataSource();
  mysqlds.setUrl(prop.getProperty("urlConnection"));
  mysqlds.setUser(prop.getProperty("user"));
  mysqlds.setPassword(prop.getProperty("password"));
  return mysqlds;
}

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

MysqlDataSource dataSource = new MysqlDataSource();
dataSource.setUser("scott");
dataSource.setPassword("tiger");
dataSource.setServerName("myDatabaseHost.example.org");
and then obtain connections from it, same as above:

Connection conn = dataSource.getConnection();
Statement stmt = conn.createStatement();
ResultSet rs = stmt.executeQuery("SELECT ID FROM USERS");
...
rs.close();
stmt.close();
conn.close();

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

MysqlDataSource dataSource = new MysqlDataSource();
 dataSource.setDatabaseName("xyz");
 dataSource.setUser("xyz");
 dataSource.setPassword("xyz");
 dataSource.setServerName("xyz.yourdomain.com");

代码示例来源:origin: boonproject/boon

protected void connect() {
  try {
    MysqlDataSource dataSource = new MysqlDataSource();
    dataSource.setURL(url);
    dataSource.setPassword(password);
    dataSource.setUser(userName);
    connection = dataSource.getConnection();
    connection.setAutoCommit(true);
    closed = false;
    totalConnectionOpen++;
  } catch (SQLException sqlException) {
    this.closed = true;
    connection = null;
    handle("Unable to connect", sqlException);
  }
}

代码示例来源:origin: boonproject/boon

protected void connect() {
  try {
    MysqlDataSource dataSource = new MysqlDataSource();
    dataSource.setURL(url);
    dataSource.setPassword(password);
    dataSource.setUser(userName);
    connection = dataSource.getConnection();
    connection.setAutoCommit(true);
    closed = false;
    totalConnectionOpen++;
  } catch (SQLException sqlException) {
    this.closed = true;
    connection = null;
    handle("Unable to connect", sqlException);
  }
}

代码示例来源:origin: io.fastjson/slumberdb-mysql

protected void connect() {
  try {
    MysqlDataSource dataSource = new MysqlDataSource();
    dataSource.setURL(url);
    dataSource.setPassword(password);
    dataSource.setUser(userName);
    connection = dataSource.getConnection();
    connection.setAutoCommit(true);
    closed = false;
    totalConnectionOpen++;
  } catch (SQLException sqlException) {
    this.closed = true;
    connection = null;
    handle("Unable to connect", sqlException);
  }
}

代码示例来源:origin: boonproject/boon

/**
 * Connects to the DB and tracks if successful so upstream stuff can try to reconnect.
 */
protected void connect() {
  try {
    MysqlDataSource dataSource = new MysqlDataSource();
    dataSource.setURL(url);
    dataSource.setPassword(password);
    dataSource.setUser(userName);
    connection = dataSource.getConnection();
    connection.setAutoCommit(true);
    closed = false;
    totalConnectionOpen++;
  } catch (SQLException sqlException) {
    this.closed = true;
    connection = null;
    handle("Unable to connect", sqlException);
  }
}

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

MysqlDataSource ds = new MysqlDataSource();
ds.setServerName(serverName);
ds.setDatabaseName(mydatabase);
ds.setUser(username);
ds.setPassword(password);
connection = ds.getConnection();

代码示例来源: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: 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 dataSource = new MysqlDataSource();
dataSource.setServerName("localhost");
dataSource.setDatabaseName("inventry");
dataSource.setPortNumber(3306);
dataSource.setUser("root");
dataSource.setPassword(""); // blank password is a terrible idea

Connection connection = dataSource.getConnection();

代码示例来源: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.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;
}

相关文章