我正在使用http://www.vogella.com/tutorials/MySQLJava/article.html上的教程,尝试通过tp连接到服务器上的sql服务器
执行该行时:
Connection connect = DriverManager
.getConnection("jdbc:mysql:http://www.findmeontheweb.biz"
+ "user=findmeon_bitcoin&password=PASSWORD");
抛出一个异常,说“No sutabled driver found for jdbc:mysql:http://www.findmeontheweb.biz
这就是我所做的。1.将“ mysql-connecter-java-5.1-33.bin.jar”下载到我的lib文件夹中。2.从首选项将jar添加到我的项目中。
项目代码:
public class cStart {
private Connection connect = null;
private Statement statement = null;
private PreparedStatement preparedStatement = null;
private ResultSet resultSet = null;
public static void main (String[] args) {
int g=0;
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.
// EXCEPTION GOES OF HEAR
Connection connect = DriverManager
.getConnection("jdbc:mysql:http://www.findmeontheweb.biz"
+ "user=findmeon_bitcoin&password=PASSWORD");
} catch (Exception e) {
System.out.println("Exception...." );
}
}
}
URL格式应如下所示
jdbc:mysql://主机名/数据库名
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句