1. 程式人生 > 其它 >com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure

com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure

技術標籤:資料庫

專案場景:

web應用

問題描述:

Web應用中使用JDBC出現Mysql連線超時異常

@Override
        public void run() {
            bytes = mmInStream.read(buffer);
            mHandler.obtainMessage(READ_DATA, bytes, -1, buffer).sendToTarget();
        }

原因分析:

原來在我的配置檔案中埠使用了8080,和tomcat記混了,在不執行tomcat時使用8080是可以的,那麼在web專案中打開了tomcat肯定不行,暈

在這裡插入圖片描述

解決方案:

換一個空閒的埠號