Cant connect to my SQL database

前端 未结 9 608
庸人自扰
庸人自扰 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:05

    connection = DriverManager.getConnection("jdbc:mysql://localhost/worlddb?" +"user=root&password=password");
    

    Try this, I have a connection to mysql db with same connection, you just add ? after the name of the db.

提交回复
热议问题