Package project7alt1

Examples of project7alt1.Driver


        assertEquals(1234, rs.getInt(2));
        conn.close();
    }

    private void testDriverObject() throws Exception {
        Driver instance = Driver.load();
        assertTrue(DriverManager.getDriver("jdbc:h2:~/test") == instance);
        Driver.unload();
        try {
            java.sql.Driver d = DriverManager.getDriver("jdbc:h2:~/test");
            fail(d.toString());
View Full Code Here


            }
        }

        if (_needH2Shutdown) {
            __log.info("Shutting down H2....");
            Driver driver = new Driver();
            try {
                driver.connect( h2Url + ";SHUTDOWN COMPACT", new Properties());
            } catch (SQLException ex) {
                // Shutdown will always return an exeption!
                if (ex.getErrorCode() != 45000) {
                    __log.error("Error shutting down H2: " + ex.getErrorCode(), ex);
                }
View Full Code Here

    private static final String PASSWORD = "";

    @Before
    public void setup() throws Exception
    {
        DataSource dataSource = new SimpleDriverDataSource(new Driver(), URL, USERNAME, PASSWORD);
        migrationManager = new DataSourceMigrationManager(dataSource);
        migrationManager.setMigrationResolver(new ResourceMigrationResolver("classpath:/test_migrations/h2/"));

        jdbcTemplate = new SimpleJdbcTemplate(dataSource);
    }
View Full Code Here

        String connectionUrl = "jdbc:h2:mem:test" + System.nanoTime();
        jdbcClient = new BaseJdbcClient(
                new JdbcConnectorId(CONNECTOR_ID),
                new BaseJdbcConfig().setConnectionUrl(connectionUrl),
                "\"",
                new Driver());

        connection = DriverManager.getConnection(connectionUrl);
        connection.createStatement().execute("CREATE SCHEMA example");

        connection.createStatement().execute("CREATE TABLE example.numbers(text varchar primary key, value bigint)");
View Full Code Here

    }

    @Provides
    public JdbcClient provideJdbcClient(JdbcConnectorId id, BaseJdbcConfig config)
    {
        return new BaseJdbcClient(id, config, "\"", new Driver());
    }
View Full Code Here

    assertThat(DdlUtils.supportsDialect("mssql")).isFalse();
  }

  @Test
  public void shouldCreateSchema() throws SQLException {
    DriverManager.registerDriver(new Driver());
    Connection connection = DriverManager.getConnection("jdbc:h2:mem:sonar_test");
    DdlUtils.createSchema(connection, "h2");

    int tableCount = countTables(connection);
View Full Code Here

    EmbeddedDatabase database = new EmbeddedDatabase(testSettings(port));
    database.start();

    try {
      String driverUrl = String.format("jdbc:h2:tcp://localhost:%d/sonar;USER=login;PASSWORD=pwd", port);
      DriverManager.registerDriver(new Driver());
      DriverManager.getConnection(driverUrl).close();
    } catch (Exception ex) {
      fail("Unable to connect after start");
    }
View Full Code Here

      .setProperty(DatabaseProperties.PROP_URL, "jdbc:h2:tcp://localhost:" + port + "/mem:sonarIT;USER=sonar;PASSWORD=sonar"));
    database.start();

    try {
      String driverUrl = String.format("jdbc:h2:tcp://localhost:%d/mem:sonarIT;USER=sonar;PASSWORD=sonar", port);
      DriverManager.registerDriver(new Driver());
      DriverManager.getConnection(driverUrl).close();
    } catch (Exception ex) {
      fail("Unable to connect after start");
    }
View Full Code Here

  }

  private void createDatabase(File dbHome, String user, String password) throws SQLException {
    String url = String.format("jdbc:h2:%s/sonar;USER=%s;PASSWORD=%s", dbHome.getAbsolutePath(), user, password);

    DriverManager.registerDriver(new Driver());
    DriverManager.getConnection(url).close();
  }
View Full Code Here

     * Make data source.
     * @return Data source for JDBC
     * @throws SQLException If it fails
     */
    private Connection connection() throws SQLException {
        return new Driver().connect(this.jdbc, new Properties());
    }
View Full Code Here

TOP

Related Classes of project7alt1.Driver

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.