0
我试图连接到我的网站上的MySQL数据库从Java。试图连接到一个mysql数据库,得到异常说,必须指定后的端口号:
目前我得到一个例外,说
必须指定端口号后:”
我谷歌堆栈溢出,发现MySQL默认端口是3306。 但我可以”找不到我如何将它添加到我的网址,现在看起来像任何信息
jdbc:mysql://http://www.findmeontheweb.biz/database name"+
“user=findmeon_bitcoin&password=password
代码:
try {
// this will load the MySQL driver, each DB has its own driver
Class.forName("com.mysql.jdbc.Driver");
// setup the connection with the DB.
Connection connect = DriverManager.getConnection("jdbc:mysql://http: //www.findmeontheweb.biz//findmeon_bitcoin//"+ "user=findmeon_bitcoin&password=oreo8157");
} catch (Exception e) {
System.out.println("Exception....");
}
为什么JDBC URL中有一大堆空格?另外,这是否是您正确的MySQL网址?而你的用户名和密码? – 2014-11-02 15:44:32
删除该空间... – SMA 2014-11-02 15:45:49
我现在拥有您的数据库凭据。我不需要购买一个.. :) – NewUser 2014-11-02 15:45:56