Package com.mysql.jdbc.jdbc2.optional

Examples of com.mysql.jdbc.jdbc2.optional.MysqlDataSourceFactory


    }
  }

  public void testInterfaceImplementation() throws Exception {
    testInterfaceImplementation(getConnectionWithProps((Properties) null));
    MysqlConnectionPoolDataSource cpds = new MysqlConnectionPoolDataSource();
    cpds.setUrl(dbUrl);
    testInterfaceImplementation(cpds.getPooledConnection().getConnection());
  }
View Full Code Here


    }

    String newUrl = String.format("jdbc:mysql:loadbalance://%s,%s/%s?%s",
        hostSpec, hostSpec, database, configs.toString());

    MysqlConnectionPoolDataSource ds = new MysqlConnectionPoolDataSource();
    ds.setUrl(newUrl);

    Connection c = ds.getPooledConnection().getConnection();
    c.createStatement().executeQuery("SELECT 1");
    c.prepareStatement("SELECT 1").executeQuery();
  }
View Full Code Here

   */
  public void testBug58728() throws Exception {
    createTable("testbug58728", "(Id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, txt VARCHAR(50))","InnoDB");
    this.stmt.executeUpdate("INSERT INTO testbug58728 VALUES (NULL, 'Text 1'), (NULL, 'Text 2')");
   
    MysqlConnectionPoolDataSource pds = new MysqlConnectionPoolDataSource();
    pds.setUrl(dbUrl);
    Statement stmt1 = pds.getPooledConnection().getConnection().createStatement();
    stmt1.executeUpdate("UPDATE testbug58728 SET txt = 'New text' WHERE Id > 0");
    ResultSet rs1 = stmt1.getResultSet();
    stmt1.close();
    if (rs1 != null) {
      rs1.close();
View Full Code Here

    // Reset event count.
    this.closeEventCount = 0;
    this.connectionErrorEventCount = 0;

    MysqlConnectionPoolDataSource ds = new MysqlConnectionPoolDataSource();

    ds.setURL(BaseTestCase.dbUrl);

    this.cpds = ds;
  }
View Full Code Here

   *
   * @throws Exception
   *             if the test fails
   */
  public void testBug35489() throws Exception {
    MysqlConnectionPoolDataSource pds = new MysqlConnectionPoolDataSource();
    pds.setUrl(dbUrl);
    this.pstmt = pds.getPooledConnection().getConnection()
        .prepareStatement("SELECT 1");
    this.pstmt.execute();
    this.pstmt.close();

    MysqlXADataSource xads = new MysqlXADataSource();
View Full Code Here

    // Reset event count.
    this.closeEventCount = 0;
    this.connectionErrorEventCount = 0;

    MysqlConnectionPoolDataSource ds = new MysqlConnectionPoolDataSource();

    ds.setURL(BaseTestCase.dbUrl);

    this.cpds = ds;
  }
View Full Code Here

   *
   * @throws Exception
   *             if an error occurs.
   */
  public void testBug4808() throws Exception {
    MysqlConnectionPoolDataSource ds = new MysqlConnectionPoolDataSource();
    ds.setURL(BaseTestCase.dbUrl);
    PooledConnection closeMeTwice = ds.getPooledConnection();
    closeMeTwice.close();
    closeMeTwice.close();

  }
View Full Code Here

    String port = System.getProperty(DS_PORT_PROP_NAME);

    // Only run this test if at least one of the above are set
    if ((databaseName != null) || (userName != null) || (password != null)
        || (port != null)) {
      MysqlConnectionPoolDataSource ds = new MysqlConnectionPoolDataSource();

      if (databaseName != null) {
        ds.setDatabaseName(databaseName);
      }

      if (userName != null) {
        ds.setUser(userName);
      }

      if (password != null) {
        ds.setPassword(password);
      }

      if (port != null) {
        ds.setPortNumber(Integer.parseInt(port));
      }

      bindDataSource(jndiName, ds);

      ConnectionPoolDataSource boundDs = null;
View Full Code Here

    String serverName = System.getProperty(DS_HOST_PROP_NAME);

    // Only run this test if at least one of the above are set
    if ((databaseName != null) || (serverName != null)
        || (userName != null) || (password != null) || (port != null)) {
      MysqlConnectionPoolDataSource ds = new MysqlConnectionPoolDataSource();

      if (databaseName != null) {
        ds.setDatabaseName(databaseName);
      }

      if (userName != null) {
        ds.setUser(userName);
      }

      if (password != null) {
        ds.setPassword(password);
      }

      if (port != null) {
        ds.setPortNumber(Integer.parseInt(port));
      }

      if (serverName != null) {
        ds.setServerName(serverName);
      }

      bindDataSource(jndiName, ds);

      ConnectionPoolDataSource boundDs = null;
View Full Code Here

    this.tempDir = File.createTempFile("jnditest", null);
    this.tempDir.delete();
    this.tempDir.mkdir();
    this.tempDir.deleteOnExit();

    MysqlConnectionPoolDataSource ds;
    Hashtable env = new Hashtable();
    env.put(Context.INITIAL_CONTEXT_FACTORY,
        "com.sun.jndi.fscontext.RefFSContextFactory");
    this.ctx = new InitialContext(env);
    assertTrue("Naming Context not created", this.ctx != null);
    ds = new MysqlConnectionPoolDataSource();
    ds.setUrl(dbUrl); // from BaseTestCase
    ds.setDatabaseName("test");
    this.ctx.bind(this.tempDir.getAbsolutePath() + "/test", ds);
  }
View Full Code Here

TOP

Related Classes of com.mysql.jdbc.jdbc2.optional.MysqlDataSourceFactory

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.