Cant connect to my SQL database

前端 未结 9 599
庸人自扰
庸人自扰 2021-01-04 18:24

So I\'m having an issue connecting to MySQL with Java. Heres my code:

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException         


        
9条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-01-04 19:07

    Try this it's hopeful for you:

    Connection con = null;
    Class.forName("com.mysql.jdbc.Driver");
    con =DriverManager.getConnection("jdbc:mysql://localhost/worlddb","root","password"); 
    

提交回复
热议问题