com.mysql.cj.MysqlConnection Java Examples

The following examples show how to use com.mysql.cj.MysqlConnection. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: JDBCMySQLProcessor.java    From quarkus with Apache License 2.0 6 votes vote down vote up
@BuildStep
List<NativeImageProxyDefinitionBuildItem> registerProxies() {
    List<NativeImageProxyDefinitionBuildItem> proxies = new ArrayList<>();
    proxies.add(new NativeImageProxyDefinitionBuildItem(JdbcConnection.class.getName()));
    proxies.add(new NativeImageProxyDefinitionBuildItem(MysqlConnection.class.getName()));
    proxies.add(new NativeImageProxyDefinitionBuildItem(Statement.class.getName()));
    proxies.add(new NativeImageProxyDefinitionBuildItem(AutoCloseable.class.getName()));
    proxies.add(new NativeImageProxyDefinitionBuildItem(JdbcStatement.class.getName()));
    proxies.add(new NativeImageProxyDefinitionBuildItem(Connection.class.getName()));
    proxies.add(new NativeImageProxyDefinitionBuildItem(ResultSet.class.getName()));
    proxies.add(
            new NativeImageProxyDefinitionBuildItem(JdbcPreparedStatement.class.getName(), JdbcStatement.class.getName()));
    proxies.add(new NativeImageProxyDefinitionBuildItem(JdbcPropertySet.class.getName(), PropertySet.class.getName(),
            Serializable.class.getName()));
    proxies.add(
            new NativeImageProxyDefinitionBuildItem(Resultset.class.getName(), ResultSetInternalMethods.class.getName()));
    proxies.add(new NativeImageProxyDefinitionBuildItem(LoadBalancedConnection.class.getName(),
            JdbcConnection.class.getName()));
    proxies.add(
            new NativeImageProxyDefinitionBuildItem(ReplicationConnection.class.getName(), JdbcConnection.class.getName()));
    proxies.add(
            new NativeImageProxyDefinitionBuildItem(ResultSetInternalMethods.class.getName(),
                    WarningListener.class.getName(), Resultset.class.getName()));
    return proxies;
}
 
Example #2
Source File: TracingQueryInterceptor.java    From brave with Apache License 2.0 6 votes vote down vote up
/**
 * MySQL exposes the host connecting to, but not the port. This attempts to get the port from the
 * JDBC URL. Ex. 5555 from {@code jdbc:mysql://localhost:5555/database}, or 3306 if absent.
 */
static void parseServerIpAndPort(MysqlConnection connection, Span span) {
  try {
    URI url = URI.create(connection.getURL().substring(5)); // strip "jdbc:"
    String remoteServiceName = connection.getProperties().getProperty("zipkinServiceName");
    if (remoteServiceName == null || "".equals(remoteServiceName)) {
      String databaseName = getDatabaseName(connection);
      if (databaseName != null && !databaseName.isEmpty()) {
        remoteServiceName = "mysql-" + databaseName;
      } else {
        remoteServiceName = "mysql";
      }
    }
    span.remoteServiceName(remoteServiceName);
    String host = getHost(connection);
    if (host != null) {
      span.remoteIpAndPort(host, url.getPort() == -1 ? 3306 : url.getPort());
    }
  } catch (Exception e) {
    // remote address is optional
  }
}
 
Example #3
Source File: LoadBalancedAutoCommitInterceptor.java    From lams with GNU General Public License v2.0 6 votes vote down vote up
public QueryInterceptor init(MysqlConnection connection, Properties props, Log log) {
    this.conn = (JdbcConnection) connection;

    String autoCommitSwapThresholdAsString = props.getProperty(PropertyDefinitions.PNAME_loadBalanceAutoCommitStatementThreshold, "0");
    try {
        this.matchingAfterStatementThreshold = Integer.parseInt(autoCommitSwapThresholdAsString);
    } catch (NumberFormatException nfe) {
        // nothing here, being handled in LoadBalancedConnectionProxy.
    }
    String autoCommitSwapRegex = props.getProperty(PropertyDefinitions.PNAME_loadBalanceAutoCommitStatementRegex, "");
    if (!"".equals(autoCommitSwapRegex)) {
        this.matchingAfterStatementRegex = autoCommitSwapRegex;
    }
    return this;

}
 
Example #4
Source File: CharsetRegressionTest.java    From FoxTelem with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Tests fix for Bug#73663 (19479242), utf8mb4 does not work for connector/j >=5.1.13
 * 
 * This test is only run when character_set_server=utf8mb4 and collation-server set to one of utf8mb4 collations (it's better to test two configurations:
 * with default utf8mb4_general_ci and one of non-default, say utf8mb4_bin)
 * 
 * @throws Exception
 */
public void testBug73663() throws Exception {

    this.rs = this.stmt.executeQuery("show variables like 'collation_server'");
    this.rs.next();
    String collation = this.rs.getString(2);

    if (collation != null && collation.startsWith("utf8mb4")
            && "utf8mb4".equals(((MysqlConnection) this.conn).getSession().getServerSession().getServerVariable("character_set_server"))) {
        Properties p = new Properties();
        p.setProperty(PropertyKey.characterEncoding.getKeyName(), "UTF-8");
        p.setProperty(PropertyKey.queryInterceptors.getKeyName(), Bug73663QueryInterceptor.class.getName());

        getConnectionWithProps(p);
        // exception will be thrown from the statement interceptor if any "SET NAMES utf8" statement is issued instead of "SET NAMES utf8mb4"
    } else {
        System.out.println(
                "testBug73663 was skipped: This test is only run when character_set_server=utf8mb4 and collation-server set to one of utf8mb4 collations.");
    }
}
 
Example #5
Source File: StatementsTest.java    From FoxTelem with GNU General Public License v3.0 6 votes vote down vote up
public void testLocalInfileHooked() throws Exception {
    createTable("localInfileHooked", "(field1 int, field2 varchar(255))");
    String streamData = "1\tabcd\n2\tefgh\n3\tijkl";
    InputStream stream = new ByteArrayInputStream(streamData.getBytes());
    try {
        ((com.mysql.cj.jdbc.JdbcStatement) this.stmt).setLocalInfileInputStream(stream);
        this.stmt.execute(
                "LOAD DATA LOCAL INFILE 'bogusFileName' INTO TABLE localInfileHooked CHARACTER SET " + CharsetMapping.getMysqlCharsetForJavaEncoding(
                        ((MysqlConnection) this.conn).getPropertySet().getStringProperty(PropertyKey.characterEncoding).getValue(), this.serverVersion));
        assertEquals(-1, stream.read());
        this.rs = this.stmt.executeQuery("SELECT field2 FROM localInfileHooked ORDER BY field1 ASC");
        this.rs.next();
        assertEquals("abcd", this.rs.getString(1));
        this.rs.next();
        assertEquals("efgh", this.rs.getString(1));
        this.rs.next();
        assertEquals("ijkl", this.rs.getString(1));
    } finally {
        ((com.mysql.cj.jdbc.JdbcStatement) this.stmt).setLocalInfileInputStream(null);
    }
}
 
Example #6
Source File: ResultSetScannerInterceptor.java    From FoxTelem with GNU General Public License v3.0 6 votes vote down vote up
@Override
public QueryInterceptor init(MysqlConnection conn, Properties props, Log log) {
    String regexFromUser = props.getProperty(PNAME_resultSetScannerRegex);

    if (regexFromUser == null || regexFromUser.length() == 0) {
        throw ExceptionFactory.createException(WrongArgumentException.class, Messages.getString("ResultSetScannerInterceptor.0"));
    }

    try {
        this.regexP = Pattern.compile(regexFromUser);
    } catch (Throwable t) {
        throw ExceptionFactory.createException(WrongArgumentException.class, Messages.getString("ResultSetScannerInterceptor.1"), t);
    }
    return this;

}
 
Example #7
Source File: LoadBalancedAutoCommitInterceptor.java    From FoxTelem with GNU General Public License v3.0 6 votes vote down vote up
@Override
public QueryInterceptor init(MysqlConnection connection, Properties props, Log log) {
    this.conn = (JdbcConnection) connection;

    String autoCommitSwapThresholdAsString = props.getProperty(PropertyKey.loadBalanceAutoCommitStatementThreshold.getKeyName(), "0");
    try {
        this.matchingAfterStatementThreshold = Integer.parseInt(autoCommitSwapThresholdAsString);
    } catch (NumberFormatException nfe) {
        // nothing here, being handled in LoadBalancedConnectionProxy.
    }
    String autoCommitSwapRegex = props.getProperty(PropertyKey.loadBalanceAutoCommitStatementRegex.getKeyName(), "");
    if (!"".equals(autoCommitSwapRegex)) {
        this.matchingAfterStatementRegex = autoCommitSwapRegex;
    }
    return this;

}
 
Example #8
Source File: AbandonedConnectionCleanupThreadSubstitutions.java    From quarkus with Apache License 2.0 5 votes vote down vote up
@Substitute
protected static void trackConnection(MysqlConnection conn, NetworkResources io) {
    synchronized (mysqlConnectionReferenceQueue) {
        ConnectionFinalizerPhantomReference reference = new ConnectionFinalizerPhantomReference(conn, io,
                mysqlConnectionReferenceQueue);
        connectionFinalizerPhantomReferences.add(reference);
    }
}
 
Example #9
Source File: TracingQueryInterceptor.java    From brave with Apache License 2.0 5 votes vote down vote up
@Override
public QueryInterceptor init(MysqlConnection mysqlConnection, Properties properties,
  Log log) {
  String exceptionInterceptors = properties.getProperty("exceptionInterceptors");
  TracingQueryInterceptor interceptor = new TracingQueryInterceptor();
  interceptor.connection = mysqlConnection;
  interceptor.interceptingExceptions = exceptionInterceptors != null &&
    exceptionInterceptors.contains(TracingExceptionInterceptor.class.getName());
  if (!interceptor.interceptingExceptions) {
    log.logWarn("TracingExceptionInterceptor not enabled. It is highly recommended to "
      + "enable it for error logging to Zipkin.");
  }
  return interceptor;
}
 
Example #10
Source File: CharsetRegressionTest.java    From FoxTelem with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Tests fix for Bug#72630 (18758686), NullPointerException during handshake in some situations
 * 
 * @throws Exception
 */
public void testBug72630() throws Exception {
    // bug is related to authentication plugins, available only in 5.5.7+ 
    if (versionMeetsMinimum(5, 5, 7)) {
        try {
            createUser("'Bug72630User'@'%'", "IDENTIFIED WITH mysql_native_password");
            this.stmt.execute("GRANT ALL ON *.* TO 'Bug72630User'@'%'");
            this.stmt.executeUpdate(((MysqlConnection) this.conn).getSession().versionMeetsMinimum(5, 7, 6)
                    ? "ALTER USER 'Bug72630User'@'%' IDENTIFIED BY 'pwd'" : "set password for 'Bug72630User'@'%' = PASSWORD('pwd')");

            final Properties props = new Properties();
            props.setProperty(PropertyKey.USER.getKeyName(), "Bug72630User");
            props.setProperty(PropertyKey.PASSWORD.getKeyName(), "pwd");
            props.setProperty(PropertyKey.characterEncoding.getKeyName(), "NonexistentEncoding");

            assertThrows(SQLException.class, "Unsupported character encoding 'NonexistentEncoding'", new Callable<Void>() {
                public Void call() throws Exception {
                    try {
                        getConnectionWithProps(props);
                        return null;
                    } catch (Exception ex) {
                        ex.printStackTrace();
                        throw ex;
                    }
                }
            });

            props.remove(PropertyKey.characterEncoding.getKeyName());
            props.setProperty(PropertyKey.passwordCharacterEncoding.getKeyName(), "NonexistentEncoding");
            assertThrows(SQLException.class, "Unsupported character encoding 'NonexistentEncoding'", new Callable<Void>() {
                public Void call() throws Exception {
                    getConnectionWithProps(props);
                    return null;
                }
            });
        } catch (SQLException e) {
            e.printStackTrace();
        }
    }
}
 
Example #11
Source File: ConnectionTest.java    From FoxTelem with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Tests isolation level functionality
 * 
 * @throws Exception
 *             if an error occurs
 */
public void testIsolationLevel() throws Exception {
    // Check initial transaction isolation level
    ((MysqlConnection) this.conn).getPropertySet().getBooleanProperty(PropertyKey.useLocalSessionState).setValue(true);
    int initialTransactionIsolation = this.conn.getTransactionIsolation();

    ((MysqlConnection) this.conn).getPropertySet().getBooleanProperty(PropertyKey.useLocalSessionState).setValue(false);
    int actualTransactionIsolation = this.conn.getTransactionIsolation();

    assertEquals("Inital transaction isolation level doesn't match the server's", actualTransactionIsolation, initialTransactionIsolation);

    // Check setting all allowed transaction isolation levels
    String[] isoLevelNames = new String[] { "Connection.TRANSACTION_NONE", "Connection.TRANSACTION_READ_COMMITTED",
            "Connection.TRANSACTION_READ_UNCOMMITTED", "Connection.TRANSACTION_REPEATABLE_READ", "Connection.TRANSACTION_SERIALIZABLE" };

    int[] isolationLevels = new int[] { Connection.TRANSACTION_NONE, Connection.TRANSACTION_READ_COMMITTED, Connection.TRANSACTION_READ_UNCOMMITTED,
            Connection.TRANSACTION_REPEATABLE_READ, Connection.TRANSACTION_SERIALIZABLE };

    DatabaseMetaData dbmd = this.conn.getMetaData();
    for (int i = 0; i < isolationLevels.length; i++) {
        if (dbmd.supportsTransactionIsolationLevel(isolationLevels[i])) {
            this.conn.setTransactionIsolation(isolationLevels[i]);

            assertTrue(
                    "Transaction isolation level that was set (" + isoLevelNames[i]
                            + ") was not returned, nor was a more restrictive isolation level used by the server",
                    this.conn.getTransactionIsolation() == isolationLevels[i] || this.conn.getTransactionIsolation() > isolationLevels[i]);
        }
    }
}
 
Example #12
Source File: ConnectionWrapper.java    From FoxTelem with GNU General Public License v3.0 5 votes vote down vote up
@Override
public boolean isWrapperFor(Class<?> iface) throws SQLException {
    boolean isInstance = iface.isInstance(this);

    if (isInstance) {
        return true;
    }

    return (iface.getName().equals(JdbcConnection.class.getName()) || iface.getName().equals(MysqlConnection.class.getName())
            || iface.getName().equals(java.sql.Connection.class.getName()) || iface.getName().equals(Wrapper.class.getName())
            || iface.getName().equals(AutoCloseable.class.getName()));
}
 
Example #13
Source File: ConnectionWrapper.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
public boolean isWrapperFor(Class<?> iface) throws SQLException {
    boolean isInstance = iface.isInstance(this);

    if (isInstance) {
        return true;
    }

    return (iface.getName().equals(JdbcConnection.class.getName()) || iface.getName().equals(MysqlConnection.class.getName())
            || iface.getName().equals(java.sql.Connection.class.getName()) || iface.getName().equals(Wrapper.class.getName())
            || iface.getName().equals(AutoCloseable.class.getName()));
}
 
Example #14
Source File: ResultSetScannerInterceptor.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
public QueryInterceptor init(MysqlConnection conn, Properties props, Log log) {
    String regexFromUser = props.getProperty(PropertyDefinitions.PNAME_resultSetScannerRegex);

    if (regexFromUser == null || regexFromUser.length() == 0) {
        throw ExceptionFactory.createException(WrongArgumentException.class, Messages.getString("ResultSetScannerInterceptor.0"));
    }

    try {
        this.regexP = Pattern.compile(regexFromUser);
    } catch (Throwable t) {
        throw ExceptionFactory.createException(WrongArgumentException.class, Messages.getString("ResultSetScannerInterceptor.1"), t);
    }
    return this;

}
 
Example #15
Source File: ServerStatusDiffInterceptor.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
public QueryInterceptor init(MysqlConnection conn, Properties props, Log l) {
    this.connection = (JdbcConnection) conn;
    this.log = l;
    return this;
}
 
Example #16
Source File: AbandonedConnectionCleanupThreadSubstitutions.java    From quarkus with Apache License 2.0 4 votes vote down vote up
ConnectionFinalizerPhantomReference(MysqlConnection conn, NetworkResources networkResources,
        ReferenceQueue<? super MysqlConnection> refQueue) {
    super(conn, refQueue);
    this.networkResources = networkResources;
}
 
Example #17
Source File: TracingQueryInterceptor.java    From brave with Apache License 2.0 4 votes vote down vote up
private static String getHost(MysqlConnection connection) {
  if (!(connection instanceof JdbcConnection)) return null;
  return ((JdbcConnection) connection).getHost();
}
 
Example #18
Source File: TracingQueryInterceptor.java    From brave with Apache License 2.0 4 votes vote down vote up
private static String getDatabaseName(MysqlConnection connection) throws SQLException {
  if (connection instanceof JdbcConnection) {
    return ((JdbcConnection) connection).getCatalog();
  }
  return "";
}
 
Example #19
Source File: MySQLQueryInterceptor.java    From core-ng-project with Apache License 2.0 4 votes vote down vote up
@Override
public QueryInterceptor init(MysqlConnection connection, Properties properties, Log log) {
    return this;
}
 
Example #20
Source File: DataSourceRegressionTest.java    From FoxTelem with GNU General Public License v3.0 4 votes vote down vote up
/**
 * Tests fix for BUG#72890 - Java jdbc driver returns incorrect return code when it's part of XA transaction
 * 
 * @throws Exception
 *             if the test fails.
 */
public void testBug72890() throws Exception {
    MysqlXADataSource myDs = new MysqlXADataSource();
    myDs.setUrl(BaseTestCase.dbUrl);

    try {
        final Xid xid = new MysqlXid("72890".getBytes(), "72890".getBytes(), 1);

        final XAConnection xaConn = myDs.getXAConnection();
        final XAResource xaRes = xaConn.getXAResource();
        final Connection dbConn = xaConn.getConnection();
        final long connId = ((MysqlConnection) ((MysqlConnection) dbConn).getConnectionMutex()).getSession().getThreadId();

        xaRes.start(xid, XAResource.TMNOFLAGS);
        xaRes.end(xid, XAResource.TMSUCCESS);
        assertEquals(XAResource.XA_OK, xaRes.prepare(xid));

        // Simulate a connection hang and make sure the connection really dies.
        this.stmt.execute("KILL CONNECTION " + connId);
        int connAliveChecks = 4;
        while (connAliveChecks > 0) {
            this.rs = this.stmt.executeQuery("SHOW PROCESSLIST");
            boolean connIsAlive = false;
            while (!connIsAlive && this.rs.next()) {
                connIsAlive = this.rs.getInt(1) == connId;
            }
            this.rs.close();
            if (connIsAlive) {
                connAliveChecks--;
                System.out.println("Connection id " + connId + " is still alive. Checking " + connAliveChecks + " more times.");
                try {
                    Thread.sleep(500);
                } catch (InterruptedException e) {
                }
            } else {
                connAliveChecks = -1;
            }
        }
        if (connAliveChecks == 0) {
            fail("Failed to kill the Connection id " + connId + " in a timely manner.");
        }

        XAException xaEx = assertThrows(XAException.class, "Undetermined error occurred in the underlying Connection - check your data for consistency",
                new Callable<Void>() {
                    public Void call() throws Exception {
                        xaRes.commit(xid, false);
                        return null;
                    }
                });
        assertEquals("XAException error code", XAException.XAER_RMFAIL, xaEx.errorCode);

        dbConn.close();
        xaConn.close();

    } finally {
        /*
         * After MySQL 5.7.7 a prepared XA transaction is no longer rolled back at disconnect. It needs to be rolled back manually to prevent test failures
         * in subsequent runs.
         * Other MySQL versions won't have any transactions to recover.
         */
        final XAConnection xaConnRecovery = myDs.getXAConnection();
        final XAResource xaResRecovery = xaConnRecovery.getXAResource();

        final Xid[] xidsToRecover = xaResRecovery.recover(XAResource.TMSTARTRSCAN);
        for (Xid xidToRecover : xidsToRecover) {
            xaResRecovery.rollback(xidToRecover);
        }

        xaConnRecovery.close();
    }
}
 
Example #21
Source File: SessionAssociationInterceptor.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
@Override
public QueryInterceptor init(MysqlConnection conn, Properties props, Log log) {
    this.connection = (JdbcConnection) conn;
    return this;
}
 
Example #22
Source File: SessionAssociationInterceptor.java    From FoxTelem with GNU General Public License v3.0 4 votes vote down vote up
@Override
public QueryInterceptor init(MysqlConnection conn, Properties props, Log log) {
    this.connection = (JdbcConnection) conn;
    return this;
}
 
Example #23
Source File: TestLifecycleInterceptor.java    From FoxTelem with GNU General Public License v3.0 4 votes vote down vote up
public ConnectionLifecycleInterceptor init(MysqlConnection conn, Properties props, Log log) {
    return this;
}
 
Example #24
Source File: BaseQueryInterceptor.java    From FoxTelem with GNU General Public License v3.0 4 votes vote down vote up
public QueryInterceptor init(MysqlConnection conn, Properties props, Log log) {
    return this;
}
 
Example #25
Source File: RetrievalPerfTest.java    From FoxTelem with GNU General Public License v3.0 4 votes vote down vote up
/**
 * Tests retrieval from the query cache
 * 
 * @throws Exception
 *             if an error occurs
 */
public void testRetrievalCached() throws Exception {
    if (!((MysqlConnection) this.conn).getSession().getServerSession().isQueryCacheEnabled()) {
        return;
    }
    this.stmt.executeUpdate("SET QUERY_CACHE_TYPE = DEMAND");

    double fullBegin = System.currentTimeMillis();
    double averageQueryTimeMs = 0;
    double averageTraversalTimeMs = 0;

    for (int i = 0; i < NUM_TESTS; i++) {
        long queryBegin = System.currentTimeMillis();
        this.rs = this.stmt.executeQuery("SELECT SQL_CACHE * FROM retrievalPerfTestHeap");

        long queryEnd = System.currentTimeMillis();
        averageQueryTimeMs += ((double) (queryEnd - queryBegin) / NUM_TESTS);

        long traverseBegin = System.currentTimeMillis();

        while (this.rs.next()) {
            this.rs.getInt(1);
            this.rs.getString(2);
        }

        long traverseEnd = System.currentTimeMillis();
        averageTraversalTimeMs += ((double) (traverseEnd - traverseBegin) / NUM_TESTS);
    }

    double fullEnd = System.currentTimeMillis();
    double fullTime = (fullEnd - fullBegin) / 1000;
    double queriesPerSec = NUM_TESTS / fullTime;
    double rowsPerSec = (NUM_ROWS * NUM_TESTS) / fullTime;
    System.out.println("\nQuery Cache From Heap Retrieval\n");
    System.out.println("Full test took: " + fullTime + " seconds.");
    System.out.println("Queries/second: " + queriesPerSec);
    System.out.println("Rows/second: " + rowsPerSec);
    System.out.println("Avg. Query Exec Time: " + averageQueryTimeMs + " ms");
    System.out.println("Avg. Traversal Time: " + averageTraversalTimeMs + " ms");

    // We're doing something wrong if we can't beat 45 seconds :(
    assertTrue(fullTime < 45);
}
 
Example #26
Source File: ServerStatusDiffInterceptor.java    From FoxTelem with GNU General Public License v3.0 4 votes vote down vote up
@Override
public QueryInterceptor init(MysqlConnection conn, Properties props, Log l) {
    this.connection = (JdbcConnection) conn;
    this.log = l;
    return this;
}
 
Example #27
Source File: ConnectionLifecycleInterceptor.java    From lams with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Called once per connection that wants to use the extension
 * 
 * The properties are the same ones passed in in the URL or arguments to
 * Driver.connect() or DriverManager.getConnection().
 * 
 * @param conn
 *            the connection for which this extension is being created
 * @param props
 *            configuration values as passed to the connection. Note that
 *            in order to support javax.sql.DataSources, configuration properties specific
 *            to an interceptor <strong>must</strong> be passed via setURL() on the
 *            DataSource. Extension properties are not exposed via
 *            accessor/mutator methods on DataSources.
 * @param log
 *            logger instance
 * @return interceptor
 */
ConnectionLifecycleInterceptor init(MysqlConnection conn, Properties props, Log log);
 
Example #28
Source File: QueryInterceptor.java    From FoxTelem with GNU General Public License v3.0 2 votes vote down vote up
/**
 * Called once per connection that wants to use the interceptor
 * 
 * The properties are the same ones passed in in the URL or arguments to
 * Driver.connect() or DriverManager.getConnection().
 * 
 * @param conn
 *            the connection for which this interceptor is being created
 * @param props
 *            configuration values as passed to the connection. Note that
 *            in order to support javax.sql.DataSources, configuration properties specific
 *            to an interceptor <strong>must</strong> be passed via setURL() on the
 *            DataSource. QueryInterceptor properties are not exposed via
 *            accessor/mutator methods on DataSources.
 * @param log
 *            logger
 * @return {@link QueryInterceptor}
 */
QueryInterceptor init(MysqlConnection conn, Properties props, Log log);
 
Example #29
Source File: ConnectionLifecycleInterceptor.java    From FoxTelem with GNU General Public License v3.0 2 votes vote down vote up
/**
 * Called once per connection that wants to use the extension
 * 
 * The properties are the same ones passed in in the URL or arguments to
 * Driver.connect() or DriverManager.getConnection().
 * 
 * @param conn
 *            the connection for which this extension is being created
 * @param props
 *            configuration values as passed to the connection. Note that
 *            in order to support javax.sql.DataSources, configuration properties specific
 *            to an interceptor <strong>must</strong> be passed via setURL() on the
 *            DataSource. Extension properties are not exposed via
 *            accessor/mutator methods on DataSources.
 * @param log
 *            logger instance
 * @return interceptor
 */
ConnectionLifecycleInterceptor init(MysqlConnection conn, Properties props, Log log);
 
Example #30
Source File: QueryInterceptor.java    From lams with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Called once per connection that wants to use the interceptor
 * 
 * The properties are the same ones passed in in the URL or arguments to
 * Driver.connect() or DriverManager.getConnection().
 * 
 * @param conn
 *            the connection for which this interceptor is being created
 * @param props
 *            configuration values as passed to the connection. Note that
 *            in order to support javax.sql.DataSources, configuration properties specific
 *            to an interceptor <strong>must</strong> be passed via setURL() on the
 *            DataSource. QueryInterceptor properties are not exposed via
 *            accessor/mutator methods on DataSources.
 * @param log
 *            logger
 * @return {@link QueryInterceptor}
 */
QueryInterceptor init(MysqlConnection conn, Properties props, Log log);