数据库连接字符串:‘:’和‘/’
jdbc:mysql://localhost:3306/testDatabase("jdbc:mysql://localhost:3306:testDatabase","root","root"):
连接数据库出错,程序报错如下:
java.sql.SQLException: Illegal connection port value '3306:test'
但是如果把3306和testDatabase之间的‘:’改为‘/’,就可以成功连接了。
DriverManager.getConnection("jdbc:mysql://localhost:3306/testDatabase","root","root"):
testDatabase为数据库名,root和root 为用户名和密码
这是为什么呢?