public JDBC4ClientInfoProvider getClientInfoProviderImpl() throws SQLException { synchronized (getConnectionMutex()) { if (this.infoProvider == null) { try { try { this.infoProvider = (JDBC4ClientInfoProvider) Util.getInstance(getClientInfoProvider(), new Class<?>[0], new Object[0], getExceptionInterceptor()); } catch (SQLException sqlEx) { if (sqlEx.getCause() instanceof ClassCastException) { // try with package name prepended this.infoProvider = (JDBC4ClientInfoProvider) Util.getInstance("com.mysql.jdbc." + getClientInfoProvider(), new Class<?>[0], new Object[0], getExceptionInterceptor()); } } } catch (ClassCastException cce) { throw SQLError.createSQLException(Messages.getString("JDBC4Connection.ClientInfoNotImplemented", new Object[] { getClientInfoProvider() }), SQLError.SQL_STATE_ILLEGAL_ARGUMENT, getExceptionInterceptor()); } this.infoProvider.initialize(this, this.props); } return this.infoProvider; } }
public JDBC4ClientInfoProvider getClientInfoProviderImpl() throws SQLException { synchronized (getConnectionMutex()) { if (this.infoProvider == null) { try { try { this.infoProvider = (JDBC4ClientInfoProvider) Util.getInstance(getClientInfoProvider(), new Class[0], new Object[0], getExceptionInterceptor()); } catch (SQLException sqlEx) { if (sqlEx.getCause() instanceof ClassCastException) { // try with package name prepended this.infoProvider = (JDBC4ClientInfoProvider) Util.getInstance("com.mysql.jdbc." + getClientInfoProvider(), new Class[0], new Object[0], getExceptionInterceptor()); } } } catch (ClassCastException cce) { throw SQLError.createSQLException(Messages.getString("JDBC4Connection.ClientInfoNotImplemented", new Object[] { getClientInfoProvider() }), SQLError.SQL_STATE_ILLEGAL_ARGUMENT, getExceptionInterceptor()); } this.infoProvider.initialize(this, this.props); } return this.infoProvider; } }
protected JDBC4ClientInfoProvider getClientInfoProviderImpl() throws SQLException { synchronized (getConnectionMutex()) { if (this.infoProvider == null) { try { try { this.infoProvider = (JDBC4ClientInfoProvider) Util.getInstance(getClientInfoProvider(), new Class[0], new Object[0], getExceptionInterceptor()); } catch (SQLException sqlEx) { if (sqlEx.getCause() instanceof ClassCastException) { // try with package name prepended this.infoProvider = (JDBC4ClientInfoProvider) Util.getInstance("com.mysql.jdbc." + getClientInfoProvider(), new Class[0], new Object[0], getExceptionInterceptor()); } } } catch (ClassCastException cce) { throw SQLError.createSQLException(Messages.getString("JDBC4Connection.ClientInfoNotImplemented", new Object[] { getClientInfoProvider() }), SQLError.SQL_STATE_ILLEGAL_ARGUMENT, getExceptionInterceptor()); } this.infoProvider.initialize(this, this.props); } return this.infoProvider; } }
public static boolean containsMessage(String msg, String key) { String[] expectedFragments = Messages.getString(key).split("\\{\\d\\}"); for (int i = 0; i < expectedFragments.length; i++) { if (msg.indexOf(expectedFragments[i]) < 0) { return false; } } return true; }
private boolean isStatementClosedForTestBug69746(Statement statement) { try { statement.getResultSet(); } catch (SQLException ex) { return ex.getMessage().equalsIgnoreCase(Messages.getString("Statement.49")); } return false; }
private boolean isResultSetClosedForTestBug69746(ResultSet resultSet) { try { resultSet.first(); } catch (SQLException ex) { return ex.getMessage().equalsIgnoreCase(Messages.getString("ResultSet.Operation_not_allowed_after_ResultSet_closed_144")); } return false; }
private static byte[] encryptPassword(String password, String seed, Connection connection, String key) throws SQLException { byte[] input = null; try { input = password != null ? StringUtils.getBytesNullTerminated(password, connection.getPasswordCharacterEncoding()) : new byte[] { 0 }; } catch (UnsupportedEncodingException e) { throw SQLError.createSQLException(Messages.getString("Sha256PasswordPlugin.3", new Object[] { connection.getPasswordCharacterEncoding() }), SQLError.SQL_STATE_GENERAL_ERROR, null); } byte[] mysqlScrambleBuff = new byte[input.length]; Security.xorString(input, mysqlScrambleBuff, seed.getBytes(), input.length); return ExportControlled.encryptWithRSAPublicKey(mysqlScrambleBuff, ExportControlled.decodeRSAPublicKey(key, ((MySQLConnection) connection).getExceptionInterceptor()), ((MySQLConnection) connection).getExceptionInterceptor()); }
protected static XAException mapXAExceptionFromSQLException(SQLException sqlEx) { Integer xaCode = MYSQL_ERROR_CODES_TO_XA_ERROR_CODES.get(sqlEx.getErrorCode()); if (xaCode != null) { return (XAException) new MysqlXAException(xaCode.intValue(), sqlEx.getMessage(), null).initCause(sqlEx); } return (XAException) new MysqlXAException(XAException.XAER_RMFAIL, Messages.getString("MysqlXAConnection.003"), null).initCause(sqlEx); }
static int checkSqlType(int sqlType, ExceptionInterceptor exceptionInterceptor) throws SQLException { if (JDBC42Helper.isSqlTypeSupported(sqlType)) { return sqlType; } throw SQLError.createSQLFeatureNotSupportedException(Messages.getString("UnsupportedSQLType.0") + JDBCType.valueOf(sqlType), SQLError.SQL_STATE_DRIVER_NOT_CAPABLE, exceptionInterceptor); }
protected static XAException mapXAExceptionFromSQLException(SQLException sqlEx) { Integer xaCode = MYSQL_ERROR_CODES_TO_XA_ERROR_CODES.get(Integer.valueOf(sqlEx.getErrorCode())); if (xaCode != null) { return (XAException) new MysqlXAException(xaCode.intValue(), sqlEx.getMessage(), null).initCause(sqlEx); } return (XAException) new MysqlXAException(XAException.XAER_RMFAIL, Messages.getString("MysqlXAConnection.003"), null).initCause(sqlEx); }