Package com.mysql.jdbc

Examples of com.mysql.jdbc.NonRegisteringDriver


    Properties props = new Properties();

    props.setProperty(NonRegisteringDriver.PROPERTIES_TRANSFORM_KEY,
        transformClassName);

    NonRegisteringDriver driver = new NonRegisteringDriver();

    Properties transformedProps = driver
        .parseURL(BaseTestCase.dbUrl, props);

    assertTrue("albequerque".equals(transformedProps
        .getProperty(NonRegisteringDriver.HOST_PROPERTY_KEY)));
  }
View Full Code Here


  }

  public void testCannedConfigs() throws Exception {
    String url = "jdbc:mysql:///?useConfigs=clusterBase";

    Properties cannedProps = new NonRegisteringDriver().parseURL(url, null);

    assertTrue("true".equals(cannedProps.getProperty("autoReconnect")));
    assertTrue("false".equals(cannedProps.getProperty("failOverReadOnly")));
    assertTrue("true".equals(cannedProps
        .getProperty("roundRobinLoadBalance")));

    // this will fail, but we test that too
    url = "jdbc:mysql:///?useConfigs=clusterBase,clusterBase2";

    try {
      cannedProps = new NonRegisteringDriver().parseURL(url, null);
      fail("should've bailed on that one!");
    } catch (SQLException sqlEx) {
      assertTrue(SQLError.SQL_STATE_INVALID_CONNECTION_ATTRIBUTE
          .equals(sqlEx.getSQLState()));
    }
View Full Code Here

   * @throws Exception
   *             if an error ocurrs.
   */
  public void testBug3554() throws Exception {
    try {
      new NonRegisteringDriver().connect(
          "jdbc:mysql://localhost:3306/?user=root&password=root",
          new Properties());
    } catch (SQLException sqlEx) {
      assertTrue(sqlEx.getMessage().indexOf("Malformed") == -1);
    }
View Full Code Here

      try {
        adminConnection = getAdminConnection();

        int bogusPortNumber = 65534;

        NonRegisteringDriver driver = new NonRegisteringDriver();

        Properties oldProps = driver.parseURL(BaseTestCase.dbUrl, null);

        String host = driver.host(oldProps);
        int port = driver.port(oldProps);
        String database = oldProps
            .getProperty(NonRegisteringDriver.DBNAME_PROPERTY_KEY);
        String user = oldProps
            .getProperty(NonRegisteringDriver.USER_PROPERTY_KEY);
        String password = oldProps
View Full Code Here

                      // work for this test
      Properties props = new Properties();
      props.setProperty("autoReconnect", "true");
      props.setProperty("failOverReadOnly", "false");

      Properties urlProps = new NonRegisteringDriver().parseURL(
          this.dbUrl, null);

      String host = urlProps.getProperty(Driver.HOST_PROPERTY_KEY);
      String port = urlProps.getProperty(Driver.PORT_PROPERTY_KEY);
View Full Code Here

  }

  public void testCannedConfigs() throws Exception {
    String url = "jdbc:mysql:///?useConfigs=clusterBase";

    Properties cannedProps = new NonRegisteringDriver().parseURL(url, null);

    assertTrue("true".equals(cannedProps.getProperty("autoReconnect")));
    assertTrue("false".equals(cannedProps.getProperty("failOverReadOnly")));
    assertTrue("true".equals(cannedProps
        .getProperty("roundRobinLoadBalance")));

    // this will fail, but we test that too
    url = "jdbc:mysql:///?useConfigs=clusterBase,clusterBase2";

    try {
      cannedProps = new NonRegisteringDriver().parseURL(url, null);
      fail("should've bailed on that one!");
    } catch (SQLException sqlEx) {
      assertTrue(SQLError.SQL_STATE_INVALID_CONNECTION_ATTRIBUTE
          .equals(sqlEx.getSQLState()));
    }
View Full Code Here

    assertTrue(
        "At least one connection was made with the localSocketAddress set",
        didOneWork);

    NonRegisteringDriver d = new NonRegisteringDriver();

    String hostname = d.host(d.parseURL(dbUrl, null));

    if (!hostname.startsWith(":") && !hostname.startsWith("localhost")) {

      int indexOfColon = hostname.indexOf(":");
View Full Code Here

    }

  }

  public void testNewHostParsing() throws Exception {
    Properties parsedProps = new NonRegisteringDriver().parseURL(dbUrl,
        null);
    String host = parsedProps
        .getProperty(NonRegisteringDriver.HOST_PROPERTY_KEY);
    String port = parsedProps
        .getProperty(NonRegisteringDriver.PORT_PROPERTY_KEY);
View Full Code Here

    jdbcUrl = System.getProperty("com.mysql.jdbc.testsuite.url");
   
    String mysqlVersion = "not-available";
   
    try {
      Connection conn = new NonRegisteringDriver().connect(jdbcUrl, null);
 
      ResultSet rs = conn.createStatement().executeQuery("SELECT VERSION()");
      rs.next();
      mysqlVersion = removeWhitespaceChars(rs.getString(1));
    } catch (Throwable t) {
View Full Code Here

  public void testJdbc4LoadBalancing() throws Exception {
    Properties props = new Properties();
    props.setProperty("loadBalanceStrategy", CountingReBalanceStrategy.class.getName());
    props.setProperty("loadBalanceAutoCommitStatementThreshold", "3");
   
    String portNumber = new NonRegisteringDriver().parseURL(dbUrl, null).getProperty(NonRegisteringDriver.PORT_PROPERTY_KEY);
   
    if (portNumber == null) {
      portNumber = "3306";
    }
   
View Full Code Here

TOP

Related Classes of com.mysql.jdbc.NonRegisteringDriver

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.