Package com.mysql.jdbc.jdbc2.optional

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


    return boundDs;
  }

  public void testCSC4616() throws Exception {
    MysqlConnectionPoolDataSource ds = new MysqlConnectionPoolDataSource();
    ds.setURL(BaseTestCase.dbUrl);
    PooledConnection pooledConn = ds.getPooledConnection();
    Connection physConn = pooledConn.getConnection();
    Statement physStatement = physConn.createStatement();

    Method enableStreamingResultsMethodStmt = Class.forName(
        "com.mysql.jdbc.jdbc2.optional.StatementWrapper").getMethod(
View Full Code Here


   * @throws Exception
   *             if the test fails.
   */
  public void testChangeUserAndCharsets() throws Exception {
    if (versionMeetsMinimum(4, 1)) {
      MysqlConnectionPoolDataSource ds = new MysqlConnectionPoolDataSource();
      ds.setURL(BaseTestCase.dbUrl);
      ds.setCharacterEncoding("utf-8");
      PooledConnection pooledConnection = ds.getPooledConnection();

      Connection connToMySQL = pooledConnection.getConnection();
      this.rs = connToMySQL.createStatement().executeQuery(
          "SELECT @@character_set_results");
      assertTrue(this.rs.next());
View Full Code Here

    }
  }

  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

   * @throws Exception
   *             if the test fails.
   */
  public void testChangeUserAndCharsets() throws Exception {
    if (versionMeetsMinimum(4, 1)) {
      MysqlConnectionPoolDataSource ds = new MysqlConnectionPoolDataSource();
      ds.setURL(BaseTestCase.dbUrl);
      ds.setCharacterEncoding("utf-8");
      PooledConnection pooledConnection = ds.getPooledConnection();

      Connection connToMySQL = pooledConnection.getConnection();
      this.rs = connToMySQL.createStatement().executeQuery(
          "SELECT @@character_set_results");
      assertTrue(this.rs.next());
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

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.