看板 java 關於我們 聯絡資訊
最近在練習SQL語法,手上沒其他資料庫軟體可用,只好拿mysql來用 好不容易找到mysql的jdbc (容我抱怨一下mysql的官網,下載失敗重連竟然還要你填一堆資料,然後最少三天 再把東西寄給你....) mysql裝完,classpath設完,寫個測試來看看有沒有連到 結果出現 com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server. 看到這個我囧了,很明顯是連不到資料庫,防火牆也關掉後 還是出現這個問題 努力奮戰半個小時,在mysql官網找到解答Orz http://bugs.mysql.com/bug.php?id=47494 (最後一個回覆) An entry has been added to the 5.1.10 changelog: The DriverManager.getConnection() method ignored a non-standard port if it was specifiedin the JDBC connection string. Connector/J always used the standard port 3306 forconnection creation. For example, if the string was jdbc:mysql://localhost:6777,Connector/J would attempt to connect to port 3306, rather than 6777. 改設成3306一試就ok,用其他的port都是這個問題Orz 結論就是mysql的port乖乖設3306就好,不要耍帥設什麼5566、7788....etc -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 210.69.178.34
tkcn:你沒看清楚 mysql 官網,其實可以不用填資料 ~__~ 07/27 09:25
a1e:不用填嗎?囧 07/27 09:28
bala045:不用= = 07/27 10:20
jayinhoward:不用填阿 07/27 10:35
hydrapin:XDDD 07/27 19:58
moremore1234:mysql的資料填寫是可以跳過的=.= 07/27 20:39
puzi:之前我下載java的時候還也跑去填...後來有一天發現不用填XD 07/30 22:24
slalala:你上了賊船了囧 08/01 21:11
maxtsai:感謝~我也遇到這個問題 卡了一個晚上 08/12 00:22