Mysql常见异常

1 字段过长
com.taobao.tddl.dbsync.applier.ApplierBrokenException: com.mysql.jdbc.MysqlDataTruncation: Data truncation: Data too long for column 'feature' at row 1
2 查询超过QueryTimeout
com.taobao.tddl.dbsync.applier.ApplierException: java.sql.SQLException: Query execution was interrupted


JDBC setQueryTimeout函数: 为了避免查询出现死循环,或时间过长等现象,而导致线程阻塞,在获得Statement的实例后,stmt.setQueryTimeout(10); 避免因为查询导致程序出现线程阻塞。 jdbc客户端怎么实现QueryTimeout的?能不能再服务端做?怎么做?


2  mysql死锁
com.mysql.jdbc.exceptions.jdbc4.MySQLTransactionRollbackException: Deadlock found when trying to get lock; try restarting transaction


3 使用了已经关闭的连接池
javax.resource.ResourceException: You are trying to use a connection factory that has been shut down: ManagedConnectionFactory is null.


4 binlog 文件被删掉,但是的索引未被删掉了
mysql> show binlog events limit 1;
ERROR 29 (HY000): File '/u01/mysql/log/mysql-bin.002293' not found (Errcode: 2)




5 没有dump binlog权限 执行show master status; 抛出的异常
    stmt = conn.createStatement();
    rs = stmt.executeQuery("SHOW MASTER STATUS");

com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Access denied; you need (at least one of) the SUPER,REPLICATION CLIENT privilege(s) for this operation












































   

你可能感兴趣的:(Mysql常见异常)