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


Java JDBCDataSource.setPassword方法代码示例

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


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

示例1: testSqlFilterComplex

import org.hsqldb.jdbc.JDBCDataSource; //导入方法依赖的package包/类
@SuppressWarnings("deprecation")
// @Test
public void testSqlFilterComplex() throws Exception {
  HashMap<String, Object> params = new HashMap<String, Object>();
  params.put("date_from", new Date("03/08/2003"));
  params.put("date_to", new Date("03/31/2010"));
  params.put("num_from", new Double(4));
  params.put("num_to", new Double(6));
  params.put("f", new Integer(3));
  params.put("t", new Integer(5));
  
  JDBCDataSource ds = new JDBCDataSource();
  ds.setDatabase(LocalTestConstants.TEST_DB_NAME);
  ds.setUser(LocalTestConstants.TEST_DB_USER);
  ds.setPassword(LocalTestConstants.TEST_DB_PASSWORD);
  
  HashMap<String, String[]> sparams = new HashMap<String, String[]>();
  sparams.put("conn", new String[] {"hsqldb"});
  testSqlFile("sql_filter_complex", true, 
                          SQL_FILTER_COMPLEX, params, ds, sparams);
}
 
开发者ID:osbitools,项目名称:OsBiToolsWs,代码行数:22,代码来源:DsDaemonTest.java

示例2: resetCredentialsCommand

import org.hsqldb.jdbc.JDBCDataSource; //导入方法依赖的package包/类
/**
 * Reset admin credentials to username/password: admin/admin
 * 
 * @throws SQLException
 */
private static void resetCredentialsCommand() throws SQLException {
	System.out.println("*** RESET ADMIN CREDENTIALS TO admin / admin ***");
	JDBCDataSource dataSource = new JDBCDataSource();
	dataSource.setUrl("jdbc:hsqldb:hsql://localhost:" + System.getProperty("dbport") + "/data");
	dataSource.setUser("sa");
	dataSource.setPassword("");
	Connection connection = dataSource.getConnection();
	// admin ~
	// $2a$10$UHdpe.t2Xr3npu1AcDygO.FkiK5Ki4SmUU8oW.gD8liApMG4yDqw6
	PreparedStatement preparedStatement = connection
			.prepareStatement("update monit_configuration set admin_username = 'admin', admin_password = '$2a$10$UHdpe.t2Xr3npu1AcDygO.FkiK5Ki4SmUU8oW.gD8liApMG4yDqw6'");
	preparedStatement.executeUpdate();
	preparedStatement.close();
	connection.close();
}
 
开发者ID:jirkapinkas,项目名称:sitemonitoring-production,代码行数:21,代码来源:Main.java

示例3: setUp

import org.hsqldb.jdbc.JDBCDataSource; //导入方法依赖的package包/类
@BeforeClass
public static void setUp() throws Exception {
  Class.forName("org.hsqldb.jdbcDriver");

  JDBCDataSource dataSource = new JDBCDataSource();
  dataSource.setUrl("jdbc:hsqldb:mem:db4");
  dataSource.setUser("sa");
  dataSource.setPassword("");

  try (Connection conn = dataSource.getConnection()) {
    try (Reader reader = Resources.getResourceAsReader("org/mybatis/scripting/freemarker/create-db.sql")) {
      ScriptRunner runner = new ScriptRunner(conn);
      runner.setLogWriter(null);
      runner.setErrorLogWriter(null);
      runner.runScript(reader);
      conn.commit();
    }
  }

  TransactionFactory transactionFactory = new JdbcTransactionFactory();
  Environment environment = new Environment("development", transactionFactory, dataSource);

  // You can call configuration.setDefaultScriptingLanguage(FreeMarkerLanguageDriver.class)
  // after this to use FreeMarker driver by default.
  Configuration configuration = new Configuration(environment);

  configuration.addMapper(CustomizedDataContextMapper.class);
  sqlSessionFactory = new SqlSessionFactoryBuilder().build(configuration);
}
 
开发者ID:mybatis,项目名称:freemarker-scripting,代码行数:30,代码来源:CustomizedDataContextTest.java

示例4: setUp

import org.hsqldb.jdbc.JDBCDataSource; //导入方法依赖的package包/类
@BeforeClass
public static void setUp() throws Exception {
  Class.forName("org.hsqldb.jdbcDriver");

  JDBCDataSource dataSource = new JDBCDataSource();
  dataSource.setUrl("jdbc:hsqldb:mem:db3");
  dataSource.setUser("sa");
  dataSource.setPassword("");

  try (Connection conn = dataSource.getConnection()) {
    try (Reader reader = Resources.getResourceAsReader("org/mybatis/scripting/freemarker/create-db.sql")) {
      ScriptRunner runner = new ScriptRunner(conn);
      runner.setLogWriter(null);
      runner.setErrorLogWriter(null);
      runner.runScript(reader);
      conn.commit();
    }
  }

  TransactionFactory transactionFactory = new JdbcTransactionFactory();
  Environment environment = new Environment("development", transactionFactory, dataSource);

  // You can call configuration.setDefaultScriptingLanguage(FreeMarkerLanguageDriver.class)
  // after this to use FreeMarker driver by default.
  Configuration configuration = new Configuration(environment);

  configuration.addMapper(PreparedParamsMapper.class);
  sqlSessionFactory = new SqlSessionFactoryBuilder().build(configuration);
}
 
开发者ID:mybatis,项目名称:freemarker-scripting,代码行数:30,代码来源:PreparedParamsTest.java

示例5: setUp

import org.hsqldb.jdbc.JDBCDataSource; //导入方法依赖的package包/类
@BeforeClass
public static void setUp() throws Exception {
  Class.forName("org.hsqldb.jdbcDriver");

  JDBCDataSource dataSource = new JDBCDataSource();
  dataSource.setUrl("jdbc:hsqldb:mem:db1");
  dataSource.setUser("sa");
  dataSource.setPassword("");

  try (Connection conn = dataSource.getConnection()) {
    try (Reader reader = Resources.getResourceAsReader("org/mybatis/scripting/freemarker/create-db.sql")) {
      ScriptRunner runner = new ScriptRunner(conn);
      runner.setLogWriter(null);
      runner.setErrorLogWriter(null);
      runner.runScript(reader);
      conn.commit();
    }
  }

  TransactionFactory transactionFactory = new JdbcTransactionFactory();
  Environment environment = new Environment("development", transactionFactory, dataSource);

  // You can call configuration.setDefaultScriptingLanguage(FreeMarkerLanguageDriver.class)
  // after this to use FreeMarker driver by default.
  Configuration configuration = new Configuration(environment);

  configuration.addMapper(NameMapper.class);
  sqlSessionFactory = new SqlSessionFactoryBuilder().build(configuration);
}
 
开发者ID:mybatis,项目名称:freemarker-scripting,代码行数:30,代码来源:FreeMarkerInAnnotationsTest.java

示例6: InMemoryDb

import org.hsqldb.jdbc.JDBCDataSource; //导入方法依赖的package包/类
public InMemoryDb() throws SQLException {
  jdbcDataSource = new JDBCDataSource();
  jdbcDataSource.setUrl("jdbc:hsqldb:mem:test;MODE=PostgreSQL");
  jdbcDataSource.setUser("SA");
  jdbcDataSource.setPassword("");
  migrateDb(jdbcDataSource);
  addTestData();
}
 
开发者ID:javaBin,项目名称:heroes,代码行数:9,代码来源:InMemoryDb.java

示例7: bootstrapInMemoryDatabase

import org.hsqldb.jdbc.JDBCDataSource; //导入方法依赖的package包/类
/** Create in-memory database table so that mapper methods might operate on something */
private JDBCDataSource bootstrapInMemoryDatabase() throws SQLException {
    JDBCDataSource dataSource = new JDBCDataSource();
    dataSource.setUrl( "jdbc:hsqldb:mem:guice-integration-test" );
    dataSource.setUser( "sa" );
    dataSource.setPassword( "" );

    try ( Connection connection = dataSource.getConnection() ) {
        connection.prepareStatement( "create table test (key varchar(20), value varchar(20))" ).execute();
    }

    return dataSource;
}
 
开发者ID:tguzik,项目名称:mybatis-metrics,代码行数:14,代码来源:GuiceIntegrationTest.java

示例8: bootstrapInMemoryDatabase

import org.hsqldb.jdbc.JDBCDataSource; //导入方法依赖的package包/类
/** Create in-memory database table so that mapper methods might operate on something */
private JDBCDataSource bootstrapInMemoryDatabase() throws SQLException {
    JDBCDataSource dataSource = new JDBCDataSource();
    dataSource.setUrl( "jdbc:hsqldb:mem:purejava-integration-test" );
    dataSource.setUser( "sa" );
    dataSource.setPassword( "" );

    try ( Connection connection = dataSource.getConnection() ) {
        connection.prepareStatement( "create table test (key varchar(20), value varchar(20))" ).execute();
    }

    return dataSource;
}
 
开发者ID:tguzik,项目名称:mybatis-metrics,代码行数:14,代码来源:PureJavaIntegrationTest.java

示例9: getDataSource

import org.hsqldb.jdbc.JDBCDataSource; //导入方法依赖的package包/类
private static DataSource getDataSource() {
  final JDBCDataSource dataSource = new JDBCDataSource();
  dataSource.setDatabase("jdbc:hsqldb:mem:persistence");
  dataSource.setUser("sa");
  dataSource.setPassword("");
  return dataSource;
}
 
开发者ID:google,项目名称:guice,代码行数:8,代码来源:EnsureJpaCanTakeObjectsInPropertiesTest.java

示例10: newDataSource

import org.hsqldb.jdbc.JDBCDataSource; //导入方法依赖的package包/类
protected ProxyDataSource newDataSource() {
    JDBCDataSource actualDataSource = new JDBCDataSource();
    actualDataSource.setUrl("jdbc:hsqldb:mem:test");
    actualDataSource.setUser("sa");
    actualDataSource.setPassword("");
    ProxyDataSource proxyDataSource = new ProxyDataSource();
    proxyDataSource.setDataSource(actualDataSource);
    proxyDataSource.setListener(new SLF4JQueryLoggingListener());
    return proxyDataSource;
}
 
开发者ID:vladmihalcea,项目名称:hibernate-master-class,代码行数:11,代码来源:ExternalDataSourceConnectionProviderTest.java

示例11: newDataSource

import org.hsqldb.jdbc.JDBCDataSource; //导入方法依赖的package包/类
protected ProxyDataSource newDataSource() {
    JDBCDataSource actualDataSource = new JDBCDataSource();
    actualDataSource.setUrl("jdbc:hsqldb:mem:test");
    actualDataSource.setUser("sa");
    actualDataSource.setPassword("");
    Properties properties = new Properties();
    properties.setProperty("hsqldb.tx_level", "SERIALIZABLE");
    actualDataSource.setProperties(properties);
    ProxyDataSource proxyDataSource = new ProxyDataSource();
    proxyDataSource.setDataSource(actualDataSource);
    proxyDataSource.setListener(new SLF4JQueryLoggingListener());
    return proxyDataSource;
}
 
开发者ID:vladmihalcea,项目名称:hibernate-master-class,代码行数:14,代码来源:TransactionIsolationExternalDataSourceExternalconfgiurationConnectionProviderTest.java

示例12: newDataSource

import org.hsqldb.jdbc.JDBCDataSource; //导入方法依赖的package包/类
private ProxyDataSource newDataSource() {
    JDBCDataSource actualDataSource = new JDBCDataSource();
    actualDataSource.setUrl("jdbc:hsqldb:mem:test");
    actualDataSource.setUser("sa");
    actualDataSource.setPassword("");
    ProxyDataSource proxyDataSource = new ProxyDataSource();
    proxyDataSource.setDataSource(actualDataSource);
    proxyDataSource.setListener(new SLF4JQueryLoggingListener());
    return proxyDataSource;
}
 
开发者ID:vladmihalcea,项目名称:hibernate-master-class,代码行数:11,代码来源:AbstractJPATest.java

示例13: dataSource

import org.hsqldb.jdbc.JDBCDataSource; //导入方法依赖的package包/类
@Bean
public DataSource dataSource() {
  JDBCDataSource ds = new JDBCDataSource();
  ds.setUrl("jdbc:hsqldb:mem:plosrepo-unittest-hsqldb;shutdown=true;sql.syntax_mys=true");
  ds.setUser("");
  ds.setPassword("");
  return ds;
}
 
开发者ID:PLOS,项目名称:content-repo,代码行数:9,代码来源:TestSpringConfig.java

示例14: HsqlDB

import org.hsqldb.jdbc.JDBCDataSource; //导入方法依赖的package包/类
@Inject
  public HsqlDB()
  {
    super();
    this.objectSequenceName = "objectSeq";
    this.transactionSequenceName = "transactionSeq";

    try
    {
      Context initContext = new InitialContext();
      Context envContext  = (Context)initContext.lookup("java:/comp/env");
      if (envContext == null) { throw new Exception("No Context Defined");}
      dataSource = (DataSource) envContext.lookup(DatabaseProperties.getJNDIDataSource());
    }
    catch (Exception e)
    {
      JDBCDataSource hsqlDataSource = new JDBCDataSource();
//      String path = "jdbc:hsqldb:mem:" + DatabaseProperties.getDatabaseName();
      // Database runs as a server
      String path = "jdbc:hsqldb:hsql://127.0.0.1/" + DatabaseProperties.getDatabaseName();
//      "jdbc:hsqldb:hsql://localhost/xdb
//      "jdbc:hsqldb:file:/opt/db/testdb", "sa", ""

      hsqlDataSource.setDatabase(path);
      hsqlDataSource.setUser(DatabaseProperties.getUser());
      hsqlDataSource.setPassword(DatabaseProperties.getPassword());

      this.dataSource = hsqlDataSource;

//      jdbcDataSource rootSource = new jdbcDataSource();
//      rootSource.setDatabase(path);
//      rootSource.setUser(DatabaseProperties.getRootUser());
//      rootSource.setPassword(DatabaseProperties.getRootPassword());
//      this.rootDataSource = rootSource;
    }
  }
 
开发者ID:terraframe,项目名称:Runway-SDK,代码行数:37,代码来源:HsqlDB.java

示例15: testDirectDataSource

import org.hsqldb.jdbc.JDBCDataSource; //导入方法依赖的package包/类
public void testDirectDataSource() throws Exception {

        final Properties properties = new Properties();

        final JDBCDataSource dataSource = new JDBCDataSource();
        dataSource.setDatabase("jdbc:hsqldb:mem:testdb" + System.currentTimeMillis());
        dataSource.setUser("sa");
        dataSource.setPassword("");
        dataSource.getConnection().close();

        properties.put("DataSource", dataSource);
        properties.put("UseDatabaseLock", "false");
        properties.put("StartupTimeout", "10000");

        ActiveMQFactory.setThreadProperties(properties);
        BrokerService broker = null;
        try {
            broker = BrokerFactory.createBroker(new URI(getBrokerUri(
                "broker:(tcp://localhost:" + brokerPort + ")?useJmx=false")));
            assertNotNull("broker is null", broker);

            final PersistenceAdapter persistenceAdapter = broker.getPersistenceAdapter();
            assertNotNull("persistenceAdapter is null", persistenceAdapter);

            assertTrue("persistenceAdapter should be an instance of JDBCPersistenceAdapter",
                persistenceAdapter instanceof JDBCPersistenceAdapter);
            final JDBCPersistenceAdapter jdbcPersistenceAdapter = (JDBCPersistenceAdapter) persistenceAdapter;

            assertSame(dataSource, jdbcPersistenceAdapter.getDataSource());
        } finally {
            stopBroker(broker);
            ActiveMQFactory.setThreadProperties(null);
        }
    }
 
开发者ID:apache,项目名称:tomee,代码行数:35,代码来源:OpenEjbBrokerFactoryTest.java


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