熟悉mysql的都知道,mysql与android关系很是亲密,在不同的平台开发app,与mysql版本是密不可分的。
前些天不幸就入坑了,mysql始终不能被app连上。
网上所说的,mysql5.0和mysql8.0的用法:
Class.forName("com.mysql.cj.jdbc.Driver");
//Class.forName("com.mysql.jdbc.Driver"); //5.0版本的
conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/test_demo?useSSL=false&serverTimezone=UTC","root","password");
//conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/test_demo","root","password"); //5.0版本的
经过我的发现,eclipse可以毫无压力的用5.0和8.0版本的。
但是,androidstudio上只能用5.0的,8.0的不能使用,6.0-7.0好像也不能用,大家可以去测试下。
5.0、8.0版本库包:https://download.youkuaiyun.com/download/qq_18235445/14929648
如有可用的,请留言。