连接mysql老是出现连接失败?

新建的java工程,测试代码如下,已经把驱动程序拷贝到JRE system liabrary 中
package com.test.tao;

import java.sql.*;
public class Test {
public static void main(String args[])
{
try{
Class.forName("com.mysql.jdbc.Driver");
System.out.print("加载数据库成功");
String str="jdbc:mysql://localhost:3306/test?"+"user=root&password=123456";
Connection conn=DriverManager.getConnection(str);

System.out.print("连接成功");
}
catch (Exception e)
{System.out.print("连接失败");}
}

}

把这个
e.printStackTrace();
输出来

String str="jdbc:mysql://localhost:3306/test?"+"user=root&password=123456";

你确定这句话正确?

我试着运行代码没问题,运行时把数据库信息改成我自己的了,你在catch语句块中加入e.printStackTrace();具体看看报错信息!